Forum OpenACS Improvement Proposals (TIPs): Re: TIP 80 (proposed): Add dynamic_p to acs-attributes

Collapse
Posted by Jade Rubick on
For reference:
create table acs_attributes (
        attribute_id    integer not null
                        constraint acs_attributes_pk
                        primary key,
        object_type     varchar(100) not null
                        constraint acs_attributes_object_type_fk
                        references acs_object_types (object_type),
        table_name      varchar(30),
        constraint acs_attrs_obj_type_tbl_name_fk
        foreign key (object_type, table_name)
        references acs_object_type_tables,
        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
                        constraint acs_attributes_datatype_fk
                        references acs_datatypes (datatype),
        default_value   text,
        min_n_values    integer default 1 not null
                        constraint acs_attributes_min_n_ck
                        check (min_n_values >= 0),
        max_n_values    integer default 1 not null
                        constraint acs_attributes_max_n_ck
                        check (max_n_values >= 0),
        storage         varchar(13) default 'type_specific'
                        constraint acs_attributes_storage_ck
                        check (storage in ('type_specific',
                                           'generic')),
        static_p        boolean default 'f',
        column_name     varchar(30),
        constraint acs_attributes_attr_name_un
        unique (attribute_name, object_type),
        constraint acs_attributes_pretty_name_un
        unique (pretty_name, object_type),
        constraint acs_attributes_sort_order_un
        unique (attribute_id, sort_order),
        constraint acs_attributes_n_values_ck
        check (min_n_values <= max_n_values)
);


comment on table acs_attributes is '
 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.
';