Index: openacs-4/packages/acs-kernel/sql/oracle/acs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-create.sql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-kernel/sql/oracle/acs-create.sql 21 Mar 2005 11:59:54 -0000 1.18 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-create.sql 18 Aug 2006 18:17:49 -0000 1.19 @@ -8,8 +8,9 @@ create table acs_magic_objects ( name varchar2(100) - constraint acs_magic_objects_pk primary key, - object_id not null constraint acs_magic_objects_object_id_fk + constraint acs_magic_objects_name_pk primary key, + object_id constraint acs_magic_objects_object_id_nn not null + constraint acs_magic_objects_object_id_fk references acs_objects(object_id) ); Index: openacs-4/packages/acs-kernel/sql/oracle/acs-logs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-logs-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-kernel/sql/oracle/acs-logs-create.sql 20 Mar 2001 22:51:55 -0000 1.1 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-logs-create.sql 18 Aug 2006 18:17:49 -0000 1.2 @@ -10,15 +10,18 @@ create table acs_logs ( log_id integer - constraint acs_logs_pk + constraint acs_logs_log_id_pk primary key, - log_date date default sysdate not null, + log_date date default sysdate + constraint acs_logs_log_date_nn not null, log_level varchar2(20) constraint acs_logs_log_level_ck check (log_level in ('notice', 'warn', 'error', 'debug')), - log_key varchar2(100) not null, - message varchar2(4000) not null + log_key varchar2(100) + constraint acs_logs_log_key_nn not null, + message varchar2(4000) + constraint acs_logs_message_nn not null ); create or replace package acs_log Index: openacs-4/packages/acs-kernel/sql/oracle/acs-metadata-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-metadata-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-kernel/sql/oracle/acs-metadata-create.sql 31 May 2006 14:16:53 -0000 1.8 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-metadata-create.sql 18 Aug 2006 18:17:49 -0000 1.9 @@ -28,24 +28,25 @@ constraint acs_object_types_pk primary key, supertype constraint acs_object_types_supertype_fk references acs_object_types (object_type), - abstract_p char(1) default 'f' not null - constraint acs_obj_types_abstract_p_ck + abstract_p char(1) default 'f' + constraint acs_object_types_abstract_p_nn not null + constraint acs_object_types_abstract_p_ck check (abstract_p in ('t', 'f')), pretty_name varchar2(1000) not null constraint acs_obj_types_pretty_name_un unique, pretty_plural varchar2(1000) not null constraint acs_obj_types_pretty_plural_un unique, - table_name varchar2(30) + table_name varchar2(30), constraint acs_object_types_table_name_un unique, id_column varchar2(30), package_name varchar2(30) not null constraint acs_object_types_pkg_name_un unique, name_method varchar2(100), type_extension_table varchar2(30), dynamic_p char(1) default 'f' - constraint acs_obj_types_dynamic_p_ck + constraint acs_object_types_dynamic_p_ck check (dynamic_p in ('t', 'f')), check ((table_name is null and id_column is null) or (table_name is not null and id_column is not null)) @@ -177,10 +178,11 @@ ------------------------------------ create table acs_datatypes ( - datatype varchar2(50) not null - constraint acs_datatypes_pk primary key, + datatype varchar2(50) + constraint acs_datatypes_datatype_nn not null + constraint acs_datatypes_datatype_pk primary key, max_n_values integer default 1 - constraint acs_datatypes_max_n_ck + constraint acs_datatypes_max_n_values_ck check (max_n_values > 0) ); @@ -268,35 +270,41 @@ create sequence acs_attribute_id_seq; create table acs_attributes ( - attribute_id integer not null - constraint acs_attributes_pk + attribute_id integer + constraint acs_attributes_attribute_id_nn not null + constraint acs_attributes_attribute_id_pk primary key, - object_type not null + object_type constraint acs_attributes_object_type_nn not null constraint acs_attributes_object_type_fk references acs_object_types (object_type), table_name varchar2(30), constraint acs_attrs_obj_type_tbl_name_fk foreign key (object_type, table_name) references acs_object_type_tables, - attribute_name varchar2(100) not null, - pretty_name varchar2(100) not null, + attribute_name varchar2(100) + constraint aa_attribute_name_nn not null, + pretty_name varchar2(100) + constraint acs_attributes_pretty_name_nn not null, pretty_plural varchar2(100), - sort_order integer not null, - datatype not null + sort_order integer + constraint acs_attributes_sort_order_nn not null, + datatype constraint acs_attributes_datatype_nn not null constraint acs_attributes_datatype_fk references acs_datatypes (datatype), default_value varchar2(4000), - min_n_values integer default 1 not null - constraint acs_attributes_min_n_ck + min_n_values integer default 1 + constraint acs_attributes_min_n_values_nn not null + constraint acs_attributes_min_n_values_ck check (min_n_values >= 0), - max_n_values integer default 1 not null - constraint acs_attributes_max_n_ck + max_n_values integer default 1 + constraint acs_attributes_max_n_values_nn not null + constraint acs_attributes_max_n_values_ck check (max_n_values >= 0), storage varchar2(13) default 'type_specific' constraint acs_attributes_storage_ck check (storage in ('type_specific', 'generic')), static_p varchar2(1) default 'f' - constraint acs_attributes_static_bool + constraint acs_attributes_static_p_ck check (static_p in ('t', 'f')), column_name varchar2(30), constraint acs_attributes_attr_name_un @@ -359,8 +367,10 @@ constraint asc_enum_values_attr_id_fk references acs_attributes (attribute_id), enum_value varchar2(1000), - pretty_name varchar2(100) not null, - sort_order integer not null, + pretty_name varchar2(100) + constraint acs_enum_values_pretty_name_nn not null, + sort_order integer + constraint acs_enum_values_sort_order_nn not null, constraint acs_enum_values_pk primary key (attribute_id, enum_value), constraint acs_enum_values_pretty_name_un Index: openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql 24 Feb 2005 13:33:00 -0000 1.20 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql 18 Aug 2006 18:17:49 -0000 1.21 @@ -126,9 +126,10 @@ create sequence acs_object_id_seq cache 1000; create table acs_objects ( - object_id integer not null - constraint acs_objects_pk primary key, - object_type not null + object_id integer + constraint acs_objects_object_id_nn not null + constraint acs_objects_object_id_pk primary key, + object_type constraint acs_objects_object_type_nn not null constraint acs_objects_object_type_fk references acs_object_types (object_type), title varchar2(1000) default null, @@ -139,9 +140,11 @@ constraint acs_objects_sec_inherit_p_ck check (security_inherit_p in ('t', 'f')), creation_user integer, - creation_date date default sysdate not null, + creation_date date default sysdate + constraint acs_objects_creation_date_nn not null, creation_ip varchar2(50), - last_modified date default sysdate not null, + last_modified date default sysdate + constraint acs_objects_last_modified_nn not null, modifying_user integer, modifying_ip varchar2(50), constraint acs_objects_context_object_un @@ -1176,13 +1179,15 @@ ------------------- create table general_objects ( - object_id not null + object_id constraint general_objects_object_id_nn not null constraint general_objects_object_id_fk references acs_objects (object_id) - constraint general_objects_pk + constraint general_objects_object_id_pk primary key, - on_which_table varchar2(30) not null, - on_what_id integer not null, + on_which_table varchar2(30) + constraint go_on_which_table_nn not null, + on_what_id integer + constraint general_objects_on_what_id_nn not null, constraint general_objects_un unique (on_which_table, on_what_id) ); Index: openacs-4/packages/acs-kernel/sql/oracle/acs-permissions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-permissions-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-kernel/sql/oracle/acs-permissions-create.sql 27 Feb 2005 01:21:07 -0000 1.9 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-permissions-create.sql 18 Aug 2006 18:17:49 -0000 1.10 @@ -19,7 +19,9 @@ --------------------------------------------- create table acs_privileges ( - privilege varchar2(100) not null constraint acs_privileges_pk + privilege varchar2(100) + constraint acs_privileges_privilege_nn not null + constraint acs_privileges_privilege_pk primary key, pretty_name varchar2(100), pretty_plural varchar2(100) @@ -137,16 +139,19 @@ ------------------------------------ create table acs_permissions ( - object_id integer not null - constraint acs_permissions_on_what_id_fk + object_id integer + constraint acs_permissions_object_id_nn not null + constraint acs_permissions_object_id_fk references acs_objects (object_id) on delete cascade, - grantee_id integer not null + grantee_id integer + constraint acs_permissions_grantee_id_nn not null constraint acs_permissions_grantee_id_fk references parties (party_id) on delete cascade, - privilege varchar(100) not null - constraint acs_permissions_priv_fk + privilege varchar(100) + constraint acs_permissions_privilege_nn not null + constraint acs_permissions_privilege_fk references acs_privileges (privilege) on delete cascade, constraint acs_permissions_pk Index: openacs-4/packages/acs-kernel/sql/oracle/acs-relationships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-relationships-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-kernel/sql/oracle/acs-relationships-create.sql 4 Jun 2006 00:45:38 -0000 1.9 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-relationships-create.sql 18 Aug 2006 18:17:49 -0000 1.10 @@ -15,21 +15,25 @@ ---------------------------------------------------------------- create table acs_rel_roles ( - role varchar2(100) not null - constraint acs_rel_roles_pk primary key, - pretty_name varchar2(100) not null, - pretty_plural varchar2(100) not null + role varchar2(100) + constraint acs_rel_roles_role_nn not null + constraint acs_rel_roles_role_pk primary key, + pretty_name varchar2(100) + constraint acs_rel_roles_pretty_name_nn not null, + pretty_plural varchar2(100) + constraint acs_rel_roles_pretty_plural_nn not null ); create table acs_rel_types ( - rel_type varchar2(100) not null - constraint acs_rel_types_pk primary key + rel_type varchar2(100) + constraint acs_rel_types_rel_type_nn not null + constraint acs_rel_types_rel_type_pk primary key constraint acs_rel_types_rel_type_fk references acs_object_types(object_type), object_type_one not null constraint acs_rel_types_obj_type_1_fk references acs_object_types (object_type), - role_one constraint acs_rel_types_role_1_fk + role_one constraint acs_rel_types_role_one_fk references acs_rel_roles (role), min_n_rels_one integer default 0 not null constraint acs_rel_types_min_n_1_ck @@ -40,7 +44,7 @@ object_type_two not null constraint acs_rel_types_obj_type_2_fk references acs_object_types (object_type), - role_two constraint acs_rel_types_role_2_fk + role_two constraint acs_rel_types_role_two_fk references acs_rel_roles (role), min_n_rels_two integer default 0 not null constraint acs_rel_types_min_n_2_ck @@ -288,20 +292,24 @@ create sequence acs_rel_id_seq; create table acs_rels ( - rel_id integer not null + rel_id integer + constraint acs_rels_rel_id_nn not null constraint acs_rels_rel_id_fk references acs_objects (object_id) on delete cascade - constraint acs_rels_pk primary key, - rel_type varchar(100) not null + constraint acs_rels_rel_id_pk primary key, + rel_type varchar(100) + constraint acs_rels_rel_type_nn not null constraint acs_rels_rel_type_fk references acs_rel_types (rel_type), - object_id_one integer not null - constraint acs_object_rels_one_fk + object_id_one integer + constraint acs_rels_object_id_one_nn not null + constraint acs_rels_object_id_one_fk references acs_objects (object_id) on delete cascade, - object_id_two integer not null - constraint acs_object_rels_two_fk + object_id_two integer + constraint acs_rels_object_id_two_nn not null + constraint acs_rels_object_id_two_fk references acs_objects (object_id) on delete cascade, constraint acs_object_rels_un unique @@ -336,8 +344,9 @@ create sequence acs_data_links_seq start with 1; create table acs_data_links ( - rel_id integer not null - constraint acs_data_links_pk primary key, + rel_id integer + constraint acs_data_links_rel_id_nn not null + constraint acs_data_links_rel_id_pk primary key, object_id_one integer not null constraint acs_data_links_one_fk references acs_objects (object_id) Index: openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql,v diff -u -r1.36 -r1.37 --- openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql 11 Aug 2006 21:58:04 -0000 1.36 +++ openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql 18 Aug 2006 18:17:49 -0000 1.37 @@ -113,11 +113,11 @@ create table apm_packages ( package_id constraint apm_packages_package_id_fk references acs_objects(object_id) - constraint apm_packages_pack_id_pk primary key, + constraint apm_packages_package_id_pk primary key, package_key constraint apm_packages_package_key_fk references apm_package_types(package_key), instance_name varchar2(300) - constraint apm_packages_inst_name_nn not null, + constraint apm_packages_instance_name_nn not null, -- default system locale for this package default_locale varchar2(30) ); @@ -533,26 +533,29 @@ '; create table apm_parameters ( - parameter_id constraint apm_parameters_fk + parameter_id constraint apm_parameters_parameter_id_fk references acs_objects(object_id) - constraint apm_parameters_pk primary key, + constraint apm_parameters_parameter_id_pk primary key, package_key varchar2(100) - constraint apm_pack_param_pack_key_nn not null - constraint apm_pack_param_type_fk + constraint apm_parameters_package_key_nn not null + constraint apm_parameters_package_key_fk references apm_package_types (package_key), parameter_name varchar2(100) constraint apm_pack_params_name_nn not null, description varchar2(2000), section_name varchar2(200), - datatype varchar2(100) not null - constraint apm_parameter_datatype_ck + datatype varchar2(100) + constraint apm_parameters_datatype_nn not null + constraint apm_parameters_datatype_ck check(datatype in ('number', 'string')), default_value varchar2(4000), - min_n_values integer default 1 not null - constraint apm_paramters_min_n_ck + min_n_values integer default 1 + constraint apm_parameters_min_n_values_nn not null + constraint apm_parameters_min_n_values_ck check (min_n_values >= 0), - max_n_values integer default 1 not null - constraint apm_paramters_max_n_ck + max_n_values integer default 1 + constraint apm_parameters_max_n_values_nn not null + constraint apm_paramaters_max_n_values_ck check (max_n_values >= 0), constraint apm_paramters_attr_name_un unique (parameter_name, package_key), @@ -771,9 +774,9 @@ create table apm_services ( service_id integer - constraint services_service_id_fk + constraint apm_services_service_id_fk references apm_packages(package_id) - constraint services_pk primary key + constraint apm_services_service_id_pk primary key ); comment on table apm_services is ' Index: openacs-4/packages/acs-kernel/sql/oracle/community-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/community-core-create.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-kernel/sql/oracle/community-core-create.sql 12 Mar 2004 18:48:49 -0000 1.13 +++ openacs-4/packages/acs-kernel/sql/oracle/community-core-create.sql 18 Aug 2006 18:17:49 -0000 1.14 @@ -208,10 +208,10 @@ -- ****************************************************************** create table parties ( - party_id not null + party_id constraint parties_party_id_nn not null constraint parties_party_id_fk references acs_objects (object_id) - constraint parties_pk primary key, + constraint parties_party_id_pk primary key, email varchar2(100) constraint parties_email_un unique, url varchar2(200) @@ -362,12 +362,14 @@ ------------- create table persons ( - person_id not null + person_id constraint persons_person_id_nn not null constraint persons_person_id_fk references parties (party_id) - constraint persons_pk primary key, - first_names varchar2(100) not null, - last_name varchar2(100) not null + constraint persons_person_id_pk primary key, + first_names varchar2(100) + constraint persons_first_names_nn not null, + last_name varchar2(100) + constraint persons_last_name_nn not null ); comment on table persons is ' Index: openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql 4 Jun 2006 00:45:38 -0000 1.10 +++ openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql 18 Aug 2006 18:17:49 -0000 1.11 @@ -17,27 +17,28 @@ -- the "DENORMALIZATION" section further below). create table composition_rels ( - rel_id constraint composition_rel_rel_id_fk + rel_id constraint composition_rels_rel_id_fk references acs_rels (rel_id) - constraint composition_rel_rel_id_pk + constraint composition_rels_rel_id_pk primary key ); create table membership_rels ( - rel_id constraint membership_rel_rel_id_fk + rel_id constraint membership_rels_rel_id_fk references acs_rels (rel_id) - constraint membership_rel_rel_id_pk + constraint membership_rels_rel_id_pk primary key, - member_state varchar2(20) not null - constraint membership_rel_mem_ck + member_state varchar2(20) + constraint mr_member_state_nn not null + constraint mr_member_state_ck check (member_state in ('merged','approved', 'needs approval', 'banned', 'rejected', 'deleted')) ); create table admin_rels ( - rel_id integer constraint admin_rel_rel_id_fk + rel_id integer constraint admin_rels_rel_id_fk references membership_rels (rel_id) - constraint admin_rel_rel_id_pk + constraint admin_rels_rel_id_pk primary key ); @@ -131,12 +132,13 @@ show errors create table group_types ( - group_type not null - constraint group_types_pk primary key - constraint group_types_obj_type_fk + group_type constraint group_types_group_type_nn not null + constraint group_types_group_type_pk primary key + constraint group_types_group_type_fk references acs_object_types (object_type), - default_join_policy varchar2(30) default 'open' not null - constraint group_types_join_policy_ck + default_join_policy varchar2(30) default 'open' + constraint gt_default_join_policy_nn not null + constraint gt_default_join_policy_ck check (default_join_policy in ('open', 'needs approval', 'closed')) ); @@ -147,12 +149,14 @@ '; create table groups ( - group_id not null + group_id constraint groups_group_id_nn not null constraint groups_group_id_fk references parties (party_id) - constraint groups_pk primary key, - group_name varchar2(1000) not null, - join_policy varchar2(30) default 'open' not null + constraint groups_group_id_pk primary key, + group_name varchar2(1000) + constraint groups_group_name_nn not null, + join_policy varchar2(30) default 'open' + constraint groups_join_policy_nn not null constraint groups_join_policy_ck check (join_policy in ('open', 'needs approval', 'closed')) @@ -162,12 +166,12 @@ create table group_type_rels ( group_rel_type_id integer constraint gtr_group_rel_type_id_pk primary key, - rel_type not null - constraint gtr_rel_type_fk + rel_type constraint group_type_rels_rel_type_nn not null + constraint group_type_rels_rel_type_fk references acs_rel_types (rel_type) on delete cascade, - group_type not null - constraint gtr_group_type_fk + group_type constraint group_type_rels_group_type_nn not null + constraint group_type_rels_group_type_fk references acs_object_types (object_type) on delete cascade, constraint gtr_group_rel_types_un unique (group_type, rel_type) @@ -186,11 +190,11 @@ create table group_rels ( group_rel_id integer constraint group_rels_group_rel_id_pk primary key, - rel_type not null + rel_type constraint group_rels_rel_type_nn not null constraint group_rels_rel_type_fk references acs_rel_types (rel_type) on delete cascade, - group_id not null + group_id constraint group_rels_group_id_nn not null constraint group_rels_group_id_fk references groups (group_id) on delete cascade, @@ -232,25 +236,26 @@ -- the more complex "on update" trigger" create table group_element_index ( - group_id not null + group_id constraint gei_group_id_nn not null constraint group_element_index_grp_id_fk references groups (group_id) on delete cascade, - element_id not null + element_id constraint gei_element_id_nn not null constraint group_element_index_elem_id_fk references parties (party_id), - rel_id not null + rel_id constraint group_element_index_rel_id_nn not null constraint group_element_index_rel_id_fk references acs_rels (rel_id) on delete cascade, - container_id not null + container_id constraint gei_container_id_nn not null constraint group_element_index_cont_id_fk references groups (group_id), - rel_type not null + rel_type constraint gei_rel_type_nn not null constraint group_elem_index_rel_type_fk references acs_rel_types (rel_type), - ancestor_rel_type varchar2(100) not null - constraint grp_el_idx_ancstr_rel_type_ck + ancestor_rel_type varchar2(100) + constraint gei_ancestor_rel_type_nn not null + constraint gei_ancestor_rel_type_ck check (ancestor_rel_type in ('composition_rel','membership_rel')), constraint group_element_index_pk primary key (element_id, group_id, rel_id) Index: openacs-4/packages/acs-kernel/sql/oracle/rel-constraints-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/rel-constraints-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-kernel/sql/oracle/rel-constraints-create.sql 30 Sep 2003 12:10:02 -0000 1.2 +++ openacs-4/packages/acs-kernel/sql/oracle/rel-constraints-create.sql 18 Aug 2006 18:17:49 -0000 1.3 @@ -38,18 +38,20 @@ primary key constraint rc_constraint_id_fk references acs_objects(object_id), - constraint_name varchar(100) not null, - rel_segment not null - constraint rc_rel_segment_fk + constraint_name varchar(100) + constraint rc_constraint_name_nn not null, + rel_segment constraint rel_constraints_rel_segment_nn not null + constraint rel_constraints_rel_segment_fk references rel_segments (segment_id), - rel_side char(3) default 'two' not null - constraint rc_rel_side_ck + rel_side char(3) default 'two' + constraint rel_constraints_rel_side_nn not null + constraint rel_constraints_rel_side_ck check (rel_side in ('one', 'two')), - required_rel_segment not null - constraint rc_required_rel_segment + required_rel_segment constraint rc_required_rel_segment_nn not null + constraint rc_required_rel_segment_fk references rel_segments (segment_id), - constraint rel_constraints_uq + constraint rel_constraints_un unique (rel_segment, rel_side, required_rel_segment) ); Index: openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql 11 Aug 2006 21:58:04 -0000 1.9 +++ openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql 18 Aug 2006 18:17:49 -0000 1.10 @@ -44,20 +44,21 @@ -- using rel_segment.delete before dropping a relationship type. create table rel_segments ( - segment_id not null + segment_id constraint rel_segments_segment_id_nn not null constraint rel_segments_segment_id_fk references parties (party_id) - constraint rel_segments_pk primary key, - segment_name varchar2(230) not null, - group_id not null + constraint rel_segments_segment_id_pk primary key, + segment_name varchar2(230) + constraint rel_segments_segment_name_nn not null, + group_id constraint rel_segments_group_id_nn not null constraint rel_segments_group_id_fk references groups (group_id) on delete cascade, - rel_type not null + rel_type constraint rel_segments_rel_type_nn not null constraint rel_segments_rel_type_fk references acs_rel_types (rel_type) on delete cascade, - constraint rel_segments_grp_rel_type_uq unique(group_id, rel_type) + constraint rel_segments_grp_rel_type_un unique(group_id, rel_type) ); -- rel_type has a foreign key reference - create an index