--
-- A simple mapping template among content types and templates.
-- Used to determine the default template to use in any particular
-- context, as well as for building any UI that allows publishers
-- to choose from a palette of templates.
--
CREATE TABLE cr_type_template_map (
content_type varchar(1000) NOT NULL,
template_id integer NOT NULL,
--
-- A token to indicate the context in which a template is appropriate,
-- such as admin or public. Should be constrained when it becomes
-- clearer how this will be used.
--
use_context varchar(100) NOT NULL,
is_default bool DEFAULT false,
PRIMARY KEY (content_type,template_id,use_context),
CONSTRAINT cr_type_template_map_ctx_fk REFERENCES cr_template_use_contexts (),
CONSTRAINT cr_type_template_map_pk REFERENCES cr_template_use_contexts (),
CONSTRAINT cr_type_template_map_tmpl_fk REFERENCES cr_template_use_contexts (),
CONSTRAINT cr_type_template_map_typ_fk REFERENCES cr_template_use_contexts (),
CONSTRAINT cr_type_template_map_typ_fk REFERENCES cr_templates (),
CONSTRAINT cr_type_template_map_tmpl_fk REFERENCES cr_templates (),
CONSTRAINT cr_type_template_map_pk REFERENCES cr_templates (),
CONSTRAINT cr_type_template_map_ctx_fk REFERENCES cr_templates (),
CONSTRAINT cr_type_template_map_typ_fk REFERENCES acs_object_types (),
CONSTRAINT cr_type_template_map_ctx_fk REFERENCES acs_object_types (),
CONSTRAINT cr_type_template_map_pk REFERENCES acs_object_types (),
CONSTRAINT cr_type_template_map_tmpl_fk REFERENCES acs_object_types ()
);
CREATE INDEX cr_ttmap_by_content_type ON cr_type_template_map (content_type);
CREATE INDEX cr_ttmap_by_template_id ON cr_type_template_map (template_id);
CREATE INDEX cr_ttmap_by_use_context ON cr_type_template_map (use_context);
CREATE TRIGGER cr_type_template_map_tr BEFORE INSERT FOR EACH ROW EXECUTE PROCEDURE cr_type_template_map_tr (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_341484 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_341485 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_341489 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_341490 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_1610626 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_1610627 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
-- Table size: 8,192 bytes
-- Table rows: 4
Tables: