--
-- Each row in the acs_attributes
table defines an
-- attribute of the specified object type. Each object of this type
-- must have a minimum of min_n_values values and a maximum of
-- max_n_values for this attribute.
--
CREATE TABLE acs_attributes (
attribute_id integer PRIMARY KEY NOT NULL,
object_type varchar(1000) NOT NULL,
--
-- If the data storage for the object type is arranged in a vertically
-- partitioned manner, then this column should indicate in which table
-- the attribute is stored.
--
table_name varchar(30),
attribute_name varchar(100) NOT NULL,
pretty_name varchar(100) NOT NULL,
pretty_plural varchar(100),
sort_order integer NOT NULL,
datatype varchar(50) NOT NULL,
default_value text(-5),
min_n_values integer DEFAULT 1 NOT NULL,
max_n_values integer DEFAULT 1 NOT NULL,
--
-- Indicates how values of this attribute are stored: either
-- "type_specific" (i.e., in the table identified by
-- object_type.table_name) or "generic" (i.e., in the
-- acs_attribute_values table). (Or we could just have a column_name and,
-- if it's null, then assume that we're using acs_attribute_values.)
--
storage varchar(13) DEFAULT 'type_specific'::character varying,
--
-- Determines whether this attribute is static. If so, only one copy of
-- the attribute's value exists for all objects of the same type. This
-- value is stored in acs_static_attr_values table if storage_type is
-- "generic". Otherwise, each object of this type can have its own
-- distinct value for the attribute.
--
static_p bool DEFAULT false,
--
-- If storage is "type_specific", column_name identifies the column in
-- the table identified by object_type.table_name that holds the values
-- of this attribute. If column_name is null, then we assume that
-- attribute_name identifies a column in the table identified by
-- object_type.table_name.
--
column_name varchar(30),
ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE ON UPDATE CASCADE,
CONSTRAINT acs_attributes_max_n_ck REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_datatype_fk REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_min_n_ck REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_n_values_ck REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_object_type_fk REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_pk REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_storage_ck REFERENCES acs_datatypes (),
CONSTRAINT acs_attrs_obj_type_tbl_name_fk REFERENCES acs_datatypes (),
CONSTRAINT acs_attributes_max_n_ck REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_datatype_fk REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_min_n_ck REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_n_values_ck REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_object_type_fk REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_pk REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attributes_storage_ck REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attrs_obj_type_tbl_name_fk REFERENCES acs_object_type_tables (),
CONSTRAINT acs_attrs_obj_type_tbl_name_fk REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_datatype_fk REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_max_n_ck REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_min_n_ck REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_n_values_ck REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_object_type_fk REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_pk REFERENCES acs_object_types (),
CONSTRAINT acs_attributes_storage_ck REFERENCES acs_object_types ()
);
CREATE UNIQUE INDEX acs_attributes_attr_name_un ON acs_attributes (attribute_name, object_type);
CREATE UNIQUE INDEX acs_attributes_pretty_name_un ON acs_attributes (pretty_name, object_type);
CREATE UNIQUE INDEX acs_attributes_sort_order_un ON acs_attributes (attribute_id, sort_order);
CREATE INDEX acs_attrs_datatype_idx ON acs_attributes (datatype);
CREATE INDEX acs_attrs_obj_type_idx ON acs_attributes (object_type);
CREATE INDEX acs_attrs_tbl_name_idx ON acs_attributes (table_name);
CREATE TRIGGER RI_ConstraintTrigger_a_340257 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340258 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340267 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340268 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_340279 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_340280 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_340289 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_340290 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340602 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340603 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340752 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_340753 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_343182 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_cascade_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_343183 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_343577 AFTER DELETE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_del (disabled)
CREATE TRIGGER RI_ConstraintTrigger_a_343578 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_noaction_upd (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_1610556 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_1610557 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
-- Tables with foreign keys that refer to acs_attributes:
--acs_attribute_descriptions(acs_attributes_datatype_fk)
--acs_attribute_descriptions(acs_attributes_max_n_ck)
--acs_attribute_descriptions(acs_attributes_min_n_ck)
--acs_attribute_descriptions(acs_attributes_n_values_ck)
--acs_attribute_descriptions(acs_attributes_object_type_fk)
--acs_attribute_descriptions(acs_attributes_pk)
--acs_attribute_descriptions(acs_attributes_storage_ck)
--acs_attribute_descriptions(acs_attrs_obj_type_tbl_name_fk)
--acs_attribute_values(acs_attributes_datatype_fk)
--acs_attribute_values(acs_attributes_max_n_ck)
--acs_attribute_values(acs_attributes_min_n_ck)
--acs_attribute_values(acs_attributes_n_values_ck)
--acs_attribute_values(acs_attributes_object_type_fk)
--acs_attribute_values(acs_attributes_pk)
--acs_attribute_values(acs_attributes_storage_ck)
--acs_attribute_values(acs_attrs_obj_type_tbl_name_fk)
--acs_enum_values(acs_attributes_datatype_fk)
--acs_enum_values(acs_attributes_max_n_ck)
--acs_enum_values(acs_attributes_min_n_ck)
--acs_enum_values(acs_attributes_n_values_ck)
--acs_enum_values(acs_attributes_object_type_fk)
--acs_enum_values(acs_attributes_pk)
--acs_enum_values(acs_attributes_storage_ck)
--acs_enum_values(acs_attrs_obj_type_tbl_name_fk)
--acs_static_attr_values(acs_attributes_datatype_fk)
--acs_static_attr_values(acs_attributes_max_n_ck)
--acs_static_attr_values(acs_attributes_min_n_ck)
--acs_static_attr_values(acs_attributes_n_values_ck)
--acs_static_attr_values(acs_attributes_object_type_fk)
--acs_static_attr_values(acs_attributes_pk)
--acs_static_attr_values(acs_attributes_storage_ck)
--acs_static_attr_values(acs_attrs_obj_type_tbl_name_fk)
--wf_attribute_value_audit(acs_attributes_datatype_fk)
--wf_attribute_value_audit(acs_attributes_max_n_ck)
--wf_attribute_value_audit(acs_attributes_min_n_ck)
--wf_attribute_value_audit(acs_attributes_n_values_ck)
--wf_attribute_value_audit(acs_attributes_object_type_fk)
--wf_attribute_value_audit(acs_attributes_pk)
--wf_attribute_value_audit(acs_attributes_storage_ck)
--wf_attribute_value_audit(acs_attrs_obj_type_tbl_name_fk)
--wf_transition_attribute_map(acs_attributes_datatype_fk)
--wf_transition_attribute_map(acs_attributes_max_n_ck)
--wf_transition_attribute_map(acs_attributes_min_n_ck)
--wf_transition_attribute_map(acs_attributes_n_values_ck)
--wf_transition_attribute_map(acs_attributes_object_type_fk)
--wf_transition_attribute_map(acs_attributes_pk)
--wf_transition_attribute_map(acs_attributes_storage_ck)
--wf_transition_attribute_map(acs_attrs_obj_type_tbl_name_fk)
-- Table size: 24,576 bytes
-- Table rows: 180
Tables: