rem {{ $Header: \\ukst76\rcsroot.7_0\model\repadm40\jin\RCS\jrrmdsch.sql 1.1 1998/06/08 13:35:14 cwilliam Exp $
rem {{ ------------------------------------------------------------------------
rem File:        $Workfile:   jrrmdsch.sql  $
rem Author:      $Author: cwilliam $
rem Date:        $Date: 1998/06/08 13:35:14 $
rem Version:     $Revision: 1.1 $
rem Status:      $State: Exp $
rem Locked_by:   $Locker:  $
rem Project:     The Oracle Common Repository
rem Description: Versioned Data Dictionary Schema
rem Notes:       
rem RealAuth:    Karl McHorton
rem IncepDate:   4th December 1997
rem Copyright:   (c) Oracle Corporation 1997. All Rights Reserved.
rem Tagline:     -- Oracle Repository: Managing *all* your data --
rem ---------------------------------------------------------------------------
rem Log of Changes from Source Control System
rem ---------------------------------------------------------------------------
rem $Log: jrrmdsch.sql $
rem Revision 1.1  1998/06/08  13:35:14  cwilliam
rem Initial revision
rem
rem 
rem    Rev 1.2   12 Jan 1998 20:37:40   kmchorto
rem Checkpoint for Schema Cutover
rem 
rem    Rev 1.1   11 Dec 1997 19:26:24   kmchorto
rem Consistent set of schema .SQL
rem 
rem    Rev 1.0   11 Dec 1997 18:11:42   kmchorto
rem WIP: testing
rem 
rem }} ------------------------------------------------------------------------
rem 

prompt Creating Repository Metadata tables ....

-- drop table m$repos_parameters;

rem -----------------------------------------------------+
prompt Table: m$repos_parameters (mrepparm)
rem -----------------------------------------------------+
rem
create table m$repos_parameters (
  parameter     varchar2(32)
 ,frozen        varchar2(1)      default 'V'
 ,value         varchar2(32)
 ,description   varchar2(128)
)
/

-- m$repparm_frozen_range
alter table m$repos_parameters add constraint m$repparm_frozen_range check (frozen in ('F', 'V'))
/

-- m$repparm_pk
alter table m$repos_parameters add constraint m$repparm_pk primary key (parameter)
/

comment on column m$repos_parameters.frozen is 'Frozen flag is set to Frozen or Volatile'
/

rem ----------------------------------------------------------------+
prompt Trigger: mrepparm_update_check
rem          prevent any updates to this table
rem          TODO: allow updates under certain conditions
rem ----------------------------------------------------------------+

create or replace trigger m$repparm_update
  before update on m$repos_parameters
  for each row
   declare
     frozen_parameter exception;
   begin
      if (:old.frozen = 'F')
         then raise frozen_parameter;
      end if;
   exception
      when frozen_parameter then 
         raise_application_error(-20105, 'Repository parameter ''' || :old.parameter || '''is frozen - cannot be changed');
   end;
/

rem -----------------------------------------------------+
prompt Table: m$nls_languages (mnlslang)
rem -----------------------------------------------------+
rem
create table m$nls_languages (
  lid            varchar2(3)
 ,enabled        varchar2(1)      default 'N'
)
/

-- m$nlslang_in_repository_range
alter table m$nls_languages add constraint m$nlslang_in_repository_range check (enabled in ('Y','N'))
/

-- m$nls_lang_pk
alter table m$nls_languages add constraint m$nls_lang_pk primary key (lid)
/


rem 
rem ----------------------------------------------------------------------------
rem }} End of file $Workfile:   jrrmdsch.sql  $  $$Header_is_done
rem ----------------------------------------------------------------------------

