
prompt Creating Versioned Data Dictionary (repos 1 tables)...


rem -----------------------------------------------------+
prompt table : i$rm$element_type_extensions
rem -----------------------------------------------------+
rem
create table i$rm$element_type_extensions (
  irid      number        not null,
  etid      number        not null, 
  help_tag  varchar2(10)
)
/

-- rm$element_type_extensions_pk
alter table i$rm$element_type_extensions add constraint rm$element_type_extensions_pk
primary key (irid)
/

-- rm$element_type_extensions_uk
alter table i$rm$element_type_extensions add constraint rm$element_type_extensions_uk
unique (etid)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_data_type_values
rem -----------------------------------------------------+
rem
create table i$rm$nls_data_type_values ( 
  irid          number        not null,
  nls_language  varchar2(3), 
  did           number, 
  seq           number, 
  dev_value     varchar2(240), 
  nls_value     varchar2(240)
)
/

-- rm$nls_data_type_values_pk
alter table i$rm$nls_data_type_values add constraint rm$nls_data_type_values_pk
primary key (irid)
/

create index rm$nls_dtv_1 on i$rm$nls_data_type_values(nls_language, did, seq)
/

create index rm$nls_dtv_2 on i$rm$nls_data_type_values(did)
/

-- CW 7-Mar-2000 Fix bug 936299, add unique key
-- rm$nls_data_type_values_uk
alter table i$rm$nls_data_type_values add constraint rm$nls_data_type_values_uk
unique (nls_language, did, dev_value)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_element_types
rem -----------------------------------------------------+
rem
create table i$rm$nls_element_types ( 
  irid             number        not null,
  nls_language     varchar2(3)   not null, 
  etid             number        not null, 
  nls_name         varchar2(240), 
  nls_plural_name  varchar2(240)
)
/

-- rm$nls_element_types_pk
alter table i$rm$nls_element_types add constraint rm$nls_element_types_pk
primary key (irid)
/

-- rm$nls_element_types_uk
alter table i$rm$nls_element_types add constraint rm$nls_element_types_uk
unique (nls_language, etid)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_languages
rem -----------------------------------------------------+
rem
create table i$rm$nls_languages ( 
  irid         number        not null,
  lang_id      varchar2(3)   not null, 
  name         varchar2(40)  not null, 
  description  varchar2(40)
)
/

-- rm$nls_languages_pk
alter table i$rm$nls_languages add constraint rm$nls_languages_pk
primary key (irid)
/

create index rm$nls_languages_1 on i$rm$nls_languages(lang_id)
/

create index rm$nls_languages_2 on i$rm$nls_languages(name, lang_id)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_messages
rem -----------------------------------------------------+
rem
create table i$rm$nls_messages ( 
  irid      number        not null,
  lang_id   varchar2(3)   not null, 
  utility   varchar2(3), 
  code      number(5), 
  severity  number(38), 
  text      varchar2(240)
)
/

-- rm$nls_messages_pk
alter table i$rm$nls_messages add constraint rm$nls_messages_pk
primary key (irid)
/

create index rm$nls_messages_1 on i$rm$nls_messages(utility, code)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_message_groups
rem -----------------------------------------------------+
rem
create table i$rm$nls_message_groups ( 
  irid          number        not null,
  utility       varchar2(3)   not null, 
  description   varchar2(240), 
  from_message  number, 
  to_message    number
)
/

-- rm$nls_message_groups_pk
alter table i$rm$nls_message_groups add constraint rm$nls_message_groups_pk
primary key (irid)
/

create index rm$nls_message_groups_1 on i$rm$nls_message_groups(utility, from_message)
/

create index rm$nls_message_groups_2 on i$rm$nls_message_groups(description, utility)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_properties
rem -----------------------------------------------------+
rem
create table i$rm$nls_properties ( 
  irid          number        not null,
  nls_language  varchar2(3)   not null, 
  pid           number        not null, 
  nls_name      varchar2(40), 
  nls_default   varchar2(240), 
  nls_hint      varchar2(240)
)
/

-- rm$nls_properties_pk
alter table i$rm$nls_properties add constraint rm$nls_properties_pk
primary key (irid)
/

-- rm$nls_properties_uk
alter table i$rm$nls_properties add constraint rm$nls_properties_uk
unique (pid, nls_language)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_text_types
rem -----------------------------------------------------+
rem
create table i$rm$nls_text_types ( 
  irid          number        not null,
  nls_language  varchar2(3), 
  text_type     varchar2(10), 
  nls_desc      varchar2(240)
)
/

-- rm$nls_text_types_pk
alter table i$rm$nls_text_types add constraint rm$nls_text_types_pk
primary key (irid)
/

-- rm$nls_text_types_uk
alter table i$rm$nls_text_types add constraint rm$nls_text_types_uk
unique (nls_language, text_type)
/

rem -----------------------------------------------------+
prompt table : i$rm$nls_utilities
rem -----------------------------------------------------+
rem
create table i$rm$nls_utilities ( 
  irid         number        not null,
  product      varchar2(4)   not null, 
  utility      varchar2(3), 
  version      varchar2(240), 
  description  varchar2(240), 
  path         varchar2(240)
)
/

-- rm$nls_utilities_pk
alter table i$rm$nls_utilities add constraint rm$nls_utilities_pk
primary key (irid)
/

create index rm$nls_utilities_1 on i$rm$nls_utilities(utility)
/

create index rm$nls_utilities_2 on i$rm$nls_utilities(product, utility)
/

rem -----------------------------------------------------+
prompt table : i$rm$property_extensions
rem -----------------------------------------------------+
rem
create table i$rm$property_extensions ( 
  irid              number        not null,
  pid               number        not null, 
  display_sequence  number, 
  dev_default       varchar2(240), 
  help_tag          varchar2(10), 
  property_group    varchar2(240), 
  data_type         varchar2(240), 
  length            number, 
  precision         number, 
  scale             number
)
/

-- rm$property_extensions_pk
alter table i$rm$property_extensions add constraint rm$property_extensions_pk
primary key (irid)
/

-- rm$property_extensions_uk
alter table i$rm$property_extensions add constraint rm$property_extensions_uk
unique (pid, display_sequence)
/

rem -----------------------------------------------------+
prompt table : i$rm$property_ranges
rem -----------------------------------------------------+
rem
create table i$rm$property_ranges ( 
  irid      number        not null,
  pid       number, 
  lo_value  varchar2(240), 
  hi_value  varchar2(240)
)
/

-- rm$property_ranges_pk
alter table i$rm$property_ranges add constraint rm$property_ranges_pk
primary key (irid)
/

create index rm$property_ranges_pid on i$rm$property_ranges (pid)
/

rem -----------------------------------------------------+
prompt table : i$rm$text_types
rem -----------------------------------------------------+
rem
create table i$rm$text_types ( 
  irid          number        not null,
  text_type     varchar2(10), 
  max_length    number, 
  is_extended   varchar2(1), 
  is_published  varchar2(1), 
  editor_type   varchar2(10)
)
/

-- rm$text_types_pk
alter table i$rm$text_types add constraint rm$text_types_pk
primary key (irid)
/

-- rm$text_types_uk
alter table i$rm$text_types add constraint rm$text_types_uk
unique (text_type)
/

rem -----------------------------------------------------+
prompt table : i$rm$text_usages
rem -----------------------------------------------------+
rem
create table i$rm$text_usages ( 
  irid           number        not null,
  etid           number        not null, 
  el_type        varchar2(20), 
  el_occur_type  varchar2(10), 
  seq            number        not null, 
  text_type      varchar2(10), 
  is_extended    varchar2(1), 
  is_published   varchar2(1)
)
/

-- rm$text_usages_pk
alter table i$rm$text_usages add constraint rm$text_usages_pk
primary key (irid)
/

create index rm$text_usages_1 on i$rm$text_usages(etid, seq)
/

rem -----------------------------------------------------+
prompt table : i$rm_data_types
rem -----------------------------------------------------+
rem
create table i$rm_data_types
( id                        number        not null
, types                     number        not null
, data_type                 varchar2(240)
, number_of_times_modified  number
, date_created              date
, created_by                varchar2(240)
, data_length               number
, data_precision            number
, data_scale                number
, supertypes                number
, date_changed              date
, changed_by                varchar2(240)
, source_ref                number
, hack_default              varchar2(240)
, mandatory                 varchar2(10)
, name                      varchar2(40)
, plural_name               varchar2(40)
, product                   varchar2(240)
, short_name                varchar2(20)
, text_type_code            varchar2(240)
, user_extension            varchar2(30)
)
/

-- rm_data_types_pk
alter table i$rm_data_types add constraint rm_data_types_pk
primary key (id)
/

-- rm_data_types_u1
alter table i$rm_data_types add constraint rm_data_types_u1
unique (name)
/

rem -----------------------------------------------------+
prompt table : i$rm_display_details
rem -----------------------------------------------------+
rem
create table i$rm_display_details ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  for_type                  number(38), 
  height                    number(38), 
  length                    number(38), 
  number_of_times_modified  number(38), 
  precision                 number(38), 
  sequence                  number(38), 
  source_ref                number(38), 
  width                     number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240), 
  data_type                 varchar2(240), 
  help                      varchar2(240), 
  hint                      varchar2(240), 
  justify                   varchar2(240), 
  label                     varchar2(240), 
  name                      varchar2(40), 
  plural_name               varchar2(40), 
  short_name                varchar2(20)
)
/

-- rm_display_details_pk
alter table i$rm_display_details add constraint rm_display_details_pk
primary key (id)
/

-- rm_display_details_u1
alter table i$rm_display_details add constraint rm_display_details_u1
unique (for_type)
/

rem ----------------------------------------------------------------------------+
prompt Table : rm_interface_implementations
rem ----------------------------------------------------------------------------+
create table rm_interface_implementations (
  interface             number  not null
, class_implementation  number  not null
, inheritance_level     number
)
/

rem ----------------------------------------------------------------------------+
prompt Table : i$rm_element_types
rem
rem CW 10-Dec-98, there is a unique key on (short_name, product)
rem I used to take substr(name, 1, 20) because short_name was 20 chars in length
rem However, for sdd_global_namespace and sdd_global_namespace_domains, they are
rem not unique within 20 chars and the constraint was being violated.
rem
rem Increased column length to 30 chars, removed the subtr
rem
rem CW 16-Feb-99 Fix bug 801758, additional columns required for cwm jol
rem
rem CW  6-May-99 Fix bug 877835, add icon property to rm_element_types
rem
rem CW 27-Aug-99 Fix bug 935055, identify persistent interfaces
rem              (interface_flag 'Y' or null)
rem
rem AM 15-feb-00 Fix bug 1196233, add versionable property to identify
rem              independently versionable types.
rem
rem AM 15-feb-00 Make is_primary non-nullable.
rem ----------------------------------------------------------------------------+
rem
create table i$rm_element_types ( 
  id                            number         not null
, types                         number         not null
, number_of_times_modified      number
, primary_row_type              number
, source_ref                    number
, supertypes                    number
, date_changed                  date
, date_created                  date
, abstract                      varchar2(9)
, changed_by                    varchar2(240)
, created_by                    varchar2(240)
, hack_default                  varchar2(240)
, name                          varchar2(40)
, plural_name                   varchar2(40)
, product                       varchar2(240)
, short_name                    varchar2(30)
, user_extension                varchar2(30)
, icon                          varchar2(256)
, jr_type                       varchar2(10)
, java_full_name                varchar2(240)
, is_primary                    varchar2(10)   not null
, display_seq_within_supertype  number
, interface_flag                varchar2(1)
, versionable                   varchar2(1)    not null 
)
/

-- rm_element_types_pk
alter table i$rm_element_types add constraint rm_element_types_pk primary key (id)
/

-- rm_element_types_u1
alter table i$rm_element_types add constraint rm_element_types_u1 unique (name, product)
/

-- rm_element_types_u2
alter table i$rm_element_types add constraint rm_element_types_u2 unique (short_name, product)
/

-- rm_element_types_u3
alter table i$rm_element_types add constraint rm_element_types_u3 unique (plural_name, product)
/

-- rm_element_types_chk_type
alter table i$rm_element_types add constraint rm_element_types_chk_type
check (jr_type in ('SYSTEM', 'DESIGNER', 'USER'))
/

create index rm_element_types_x1 on i$rm_element_types (primary_row_type)
/

rem -----------------------------------------------------+
prompt table : i$rm_expressions
rem -----------------------------------------------------+
rem
create table i$rm_expressions ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  assertion                 number(38), 
  bind_context              number(38), 
  message_parameter         number(38), 
  number_of_times_modified  number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240), 
  syntax                    varchar2(240), 
  text                      varchar2(500)
)
/

-- rm_expressions_pk
alter table i$rm_expressions add constraint rm_expressions_pk
primary key (id)
/

-- rm_expressions_u1
alter table i$rm_expressions add constraint rm_expressions_u1
unique (assertion)
/

create index rm_expressions_x1 on i$rm_expressions (syntax)
/

rem -----------------------------------------------------+
prompt table : i$rm_expression_prop_usages
rem -----------------------------------------------------+
rem
create table i$rm_expression_prop_usages ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  context                   number(38), 
  expression                number(38), 
  exp_seq                   number, 
  number_of_times_modified  number(38), 
  property                  number(38), 
  temp                      number(38), 
  trv_seq                   number, 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240)
)
/

-- rm_expression_property_usag_pk
alter table i$rm_expression_prop_usages add constraint rm_expression_property_usag_pk
primary key (id)
/

create index rm_expression_property_usag_x1 on i$rm_expression_prop_usages (property)
/

create index rm_expression_property_usag_x2 on i$rm_expression_prop_usages (context)
/

create index rm_expression_property_usag_x3 on i$rm_expression_prop_usages (expression)
/

rem -----------------------------------------------------------------------+
prompt table : i$rm_link_properties
rem
rem cw 15-jan-99
rem fix bug 770967, add ofk info rm model
rem
rem cw 24-feb-99
rem fix bug 801758, additional columns required for cwm jol
rem
rem CW 27-Aug-99, fix bugs
rem 869217 On an association to a supertype, add a flag to indicate whether
rem        or not to display subtypes (display_subtypes, 'Y' or null)
rem 869219 Define scope of association, eg. for tablespace for a DB object
rem        only list tablespaces within the current database_user. In this
rem        case, scope = 1 (scope_name_lov)
rem 869220 Flag an association if it is part of a hierarchical link, and
rem        indicate direction (hierarchy, 'U' or 'D')
rem -----------------------------------------------------------------------+
rem
create table i$rm_link_properties ( 
  id                        number(38)    not null
, types                     number(38)    not null
, arc_no                    number(38)
, defined_against           number(38)
, descriptor_sequence       number(38)
, link_type                 number(38)
, max_cardinality           number(38)
, min_cardinality           number(38)
, number_of_times_modified  number(38)
, of_domain                 number(38)
, property_group            number(38)
, report_seq                number(38)
, sequence_in_type          number(38)
, sequence_in_link          number
, source_ref                number(38)
, supertypes                number(38)
, date_changed              date
, date_created              date
, case_mode                 varchar2(10)
, changed_by                varchar2(240)
, created_by                varchar2(240)
, displayed                 varchar2(10)
, enforce_lov               varchar2(240)
, friendly_name             varchar2(240)
, hack_default              varchar2(240)
, is_stored                 varchar2(10)
, maintained                varchar2(10)
, mandatory                 varchar2(10)
, name                      varchar2(40)
, plural_name               varchar2(40)
, product                   varchar2(240)
, short_name                varchar2(20)
, updateable                varchar2(240)
, update_mode               varchar2(10)
, user_extension            varchar2(30)
, is_owning_association     varchar2(1)
, can_create                varchar2(1)
, customised_query          varchar2(100)
, navigable                 varchar2(1)
, ordered_set               varchar2(1)
, transferable              varchar2(1)
, aggregation               varchar2(10)
, display_subtypes          varchar2(1)
, scope_name_lov            number
, hierarchy                 varchar2(1)
)
/

-- rm_link_properties_pk
alter table i$rm_link_properties add constraint rm_link_properties_pk
primary key (id)
/

create index rm_link_properties_x1 on i$rm_link_properties (name)
/

create index rm_link_properties_x2 on i$rm_link_properties (defined_against)
/

create index rm_link_properties_x3 on i$rm_link_properties (link_type)
/

create index rm_link_properties_x4 on i$rm_link_properties (of_domain)
/

rem -----------------------------------------------------+
prompt table : i$rm_link_types
rem -----------------------------------------------------+
rem
create table i$rm_link_types ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  number_of_times_modified  number(38), 
  source_ref                number(38), 
  supertypes                number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240), 
  hack_default              varchar2(240), 
  name                      varchar2(40), 
  plural_name               varchar2(40), 
  product                   varchar2(240), 
  short_name                varchar2(20), 
  user_extension            varchar2(30)
)
/

-- rm_link_types_pk
alter table i$rm_link_types add constraint rm_link_types_pk
primary key (id)
/

-- rm_link_types_u1
alter table i$rm_link_types add constraint rm_link_types_u1
unique (name)
/

rem -----------------------------------------------------+
prompt table : i$rm_message_usages
rem -----------------------------------------------------+
rem
create table i$rm_message_usages ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  nls_code                  number(38), 
  number_of_times_modified  number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240), 
  name                      varchar2(40), 
  nls_utility               varchar2(240)
)
/

-- rm_message_usages_pk
alter table i$rm_message_usages add constraint rm_message_usages_pk
primary key (id)
/

-- rm_message_usages_u1
alter table i$rm_message_usages add constraint rm_message_usages_u1
unique (name)
/

create index rm_message_usages_x1 on i$rm_message_usages (nls_code)
/

create index rm_message_usages_x2 on i$rm_message_usages (nls_utility)
/

rem -----------------------------------------------------+
prompt table : i$rm_properties
rem -----------------------------------------------------+
rem
create table i$rm_properties ( 
  id                        number    not null
, types                     number    not null
, defined_against           number
, descriptor_sequence       number
, number_of_times_modified  number
, of_domain                 number
, property_group            number
, report_seq                number
, sequence_in_type          number
, source_ref                number
, supertypes                number
, date_changed              date
, date_created              date
, case_mode                 varchar2(10)
, changed_by                varchar2(240)
, created_by                varchar2(240)
, displayed                 varchar2(10) 
, enforce_lov               varchar2(240)
, hack_default              varchar2(240)
, is_stored                 varchar2(10)
, maintained                varchar2(10)
, mandatory                 varchar2(10)
, name                      varchar2(40)
, plural_name               varchar2(40)
, product                   varchar2(240)
, short_name                varchar2(20)
, updateable                varchar2(240)
, update_mode               varchar2(10)
, user_extension            varchar2(30)
, arc_no                    number
, java_datatype             varchar2(240)
)
/

-- rm_properties_pk
alter table i$rm_properties add constraint rm_properties_pk
primary key (id)
/

create index rm_properties_x1 on i$rm_properties (name)
/

create index rm_properties_x2 on i$rm_properties (defined_against)
/

create index rm_properties_x3 on i$rm_properties (of_domain)
/

rem -----------------------------------------------------+
prompt table : i$rm_property_maps
rem -----------------------------------------------------+
rem
create table i$rm_property_maps ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  context                   number(38), 
  in_column                 number(38), 
  number_of_times_modified  number(38), 
  property                  number(38), 
  row_type                  number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240)
)
/

-- rm_property_maps_pk
alter table i$rm_property_maps add constraint rm_property_maps_pk
primary key (id)
/

create index rm_property_maps_x1 on i$rm_property_maps (context)
/

create index rm_property_maps_x2 on i$rm_property_maps (property)
/

create index rm_property_maps_x3 on i$rm_property_maps (in_column)
/

rem -----------------------------------------------------+
prompt table : i$rm_sql_row_types
rem -----------------------------------------------------+
rem
create table i$rm_sql_row_types ( 
  id                        number(38)    not null, 
  types                     number(38)    not null, 
  number_of_times_modified  number(38), 
  source_ref                number(38), 
  table_mapped              number(38), 
  date_changed              date, 
  date_created              date, 
  changed_by                varchar2(240), 
  created_by                varchar2(240), 
  name                      varchar2(40), 
  plural_name               varchar2(40), 
  short_name                varchar2(20)
)
/

-- rm_sql_row_types_pk
alter table i$rm_sql_row_types add constraint rm_sql_row_types_pk
primary key (id)
/

-- rm_sql_row_types_u1
alter table i$rm_sql_row_types add constraint rm_sql_row_types_u1
unique (name)
/

-- rm_sql_row_types_u2
alter table i$rm_sql_row_types add constraint rm_sql_row_types_u2
unique (table_mapped)
/

rem -----------------------------------------------------+
prompt table : rm_link_customized_query
rem -----------------------------------------------------+
rem
create table rm_link_customized_query(
  query_name           varchar2(100)    not null
, query_text           varchar2(4000)   not null
, alias                varchar2(20)
, number_of_properties number(3)
, folder_context       varchar2(1)
, object_context       varchar2(1)
)
/

rem -----------------------------------------------------+
prompt table : rm_link_customized_query_bind
rem -----------------------------------------------------+
rem
create table rm_link_customized_query_bind(
  query_name           varchar2(100)      not null
 ,bind_name            varchar2(10)       not null
 ,bind_property_name   varchar2(40)       not null
 ,bind_sequence        number(2)          not null
)
/

rem -----------------------------------------------------+
prompt table : rm_link_descriptor_properties
rem
rem Fix bug 926699, allow a set of properties to be
rem ordered by when querying via an association
rem -----------------------------------------------------+
rem
create table rm_link_descriptor_properties(
  property    number      not null
 ,link_type   number      not null
 ,sequence    number      not null
)
/

rem -----------------------------------------------------+
prompt Table : rm_element_types_old
rem
rem Table to preserve guids from previous registration
rem -----------------------------------------------------+
create table rm_element_types_old
( irid                      number        not null
, name                      varchar2(40)
, primary_row_type          number
)
/

rem -----------------------------------------------------+
prompt Table : rm_sql_row_types_old
rem
rem Table to preserve guids from previous registration
rem -----------------------------------------------------+
create table rm_sql_row_types_old
( irid                    number    not null
, table_mapped            number
)
/

