/*****************************************************************************
*
* Filename         - $Workfile:   user_group.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          -
*
* Contents         - Live Schema: user_group table and associated items
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   user_group.sql  $  $Revision:   1.4  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /pvcsarch/db_ora/db/source/live/tables/user_group.svl  $
 *
 *    Rev 1.4   21 Jun 2001 14:48:26   tagtrak
 * OR:
 * CR:
 * Re-baseline version 4.0.0 to include patches.
 *
 *    Rev 1.3   16 Dec 1998 11:34:52   tagtrak
 * OR: 12412 12200
 * CR: 12412
 * REV:
 * Extent user_group table and associated views, procedures
 * and functions, to handle more than 50 privilege codes.
 * This was extended to 62, to allow upper and lower case alphabet
 * plus 10 digits.
 * -------------
 * Andrew Walker
 * -------------
 * (branch ATS revision copied to trunk.)
 * Andrew Walker
 *
 *    Rev 1.2.1.0   24 Nov 1998 16:10:48   tagtrak
 * OR: 12412 12200
 * CR: 12412
 * REV:
 * Extent user_group table and associated views, procedures
 * and functions, to handle more than 50 privilege codes.
 * This was extended to 62, to allow upper and lower case alphabet
 * plus 10 digits.
 * -------------
 * Andrew Walker
 *
 *    Rev 1.2   02 Apr 1998 19:43:58   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial Issue
 * See label for concession
 *
 *    Rev 1.1   26 Feb 1998 14:02:48   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 *
 *    Rev 1.0.1.1   26 Feb 1998 11:08:36   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial core product version
 *
 *    Rev 1.0.1.0   27 Jan 1998 16:20:24   tagtrak
 * Added agent_code field to support data privacy,and
 * extended PK to group_name and agent_code.
 *    Rev 1.0   22 Oct 1997 11:08:30   tagtrak
 * OR:
 * CR:
 * REV:
 * Initial check-in
*
****************************************************************************/

PROMPT Creating table USER_GROUP

create table USER_GROUP (
   group_name                    char(15) not null,
   priv1                         char(1) not null,
   priv2                         char(1),
   priv3                         char(1),
   priv4                         char(1),
   priv5                         char(1),
   priv6                         char(1),
   priv7                         char(1),
   priv8                         char(1),
   priv9                         char(1),
   priv10                        char(1),
   priv11                        char(1),
   priv12                        char(1),
   priv13                        char(1),
   priv14                        char(1),
   priv15                        char(1),
   priv16                        char(1),
   priv17                        char(1),
   priv18                        char(1),
   priv19                        char(1),
   priv20                        char(1),
   priv21                        char(1),
   priv22                        char(1),
   priv23                        char(1),
   priv24                        char(1),
   priv25                        char(1),
   priv26                        char(1),
   priv27                        char(1),
   priv28                        char(1),
   priv29                        char(1),
   priv30                        char(1),
   priv31                        char(1),
   priv32                        char(1),
   priv33                        char(1),
   priv34                        char(1),
   priv35                        char(1),
   priv36                        char(1),
   priv37                        char(1),
   priv38                        char(1),
   priv39                        char(1),
   priv40                        char(1),
   priv41                        char(1),
   priv42                        char(1),
   priv43                        char(1),
   priv44                        char(1),
   priv45                        char(1),
   priv46                        char(1),
   priv47                        char(1),
   priv48                        char(1),
   priv49                        char(1),
   priv50                        char(1),
   priv51                        char(1),
   priv52                        char(1),
   priv53                        char(1),
   priv54                        char(1),
   priv55                        char(1),
   priv56                        char(1),
   priv57                        char(1),
   priv58                        char(1),
   priv59                        char(1),
   priv60                        char(1),
   priv61                        char(1),
   priv62                        char(1),
   priv63                        char(1),
   priv64                        char(1),
   priv65                        char(1),
   priv66                        char(1),
   priv67                        char(1),
   priv68                        char(1),
   priv69                        char(1),
   priv70                        char(1),
   priv71                        char(1),
   priv72                        char(1),
   priv73                        char(1),
   priv74                        char(1),
   priv75                        char(1),
   priv76                        char(1),
   priv77                        char(1),
   priv78                        char(1),
   priv79                        char(1),
   priv80                        char(1),
   priv81                        char(1),
   priv82                        char(1),
   priv83                        char(1),
   priv84                        char(1),
   priv85                        char(1),
   priv86                        char(1),
   priv87                        char(1),
   priv88                        char(1),
   priv89                        char(1),
   priv90                        char(1),
   priv91                        char(1),
   priv92                        char(1),
   priv93                        char(1),
   priv94                        char(1),
   priv95                        char(1),
   priv96                        char(1),
   priv97                        char(1),
   priv98                        char(1),
   priv99                        char(1),
   priv100                       char(1),
   last_user                     number(10) not null,
   agent_code                    char(5) not null,
   airport_code                  char(3) not null,
   user_role_id                  number not null,
   row_create_time               date,
   row_date_time                 date,
   cuser                         varchar2(30),
   muser                         varchar2(30),
   mterm                         varchar2(64),
   source                        varchar2(8),
   to_be_archived                varchar2(1),
   appn_row_id                   number(18) not null,
   system_id                     number(4) default 0 not null
);

alter table user_group add ( constraint user_group_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table USER_GROUP add (constraint user_group_uk1 unique (GROUP_NAME,agent_code) using index tablespace &1._indexes);

COMMENT ON TABLE USER_GROUP IS 'This table contains details of the privileges associated with user groups';

COMMENT ON COLUMN USER_GROUP.AGENT_CODE IS  'Agent code';
COMMENT ON COLUMN USER_GROUP.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN USER_GROUP.GROUP_NAME IS  'Group name';
COMMENT ON COLUMN USER_GROUP.LAST_USER IS  'User identifier of the last user to update this row';
COMMENT ON COLUMN USER_GROUP.PRIV1 IS  'Privilege 1';
COMMENT ON COLUMN USER_GROUP.PRIV10 IS  'Privilege 10';
COMMENT ON COLUMN USER_GROUP.PRIV100 IS  'Privilege 100';
COMMENT ON COLUMN USER_GROUP.PRIV11 IS  'Privilege 11';
COMMENT ON COLUMN USER_GROUP.PRIV12 IS  'Privilege 12';
COMMENT ON COLUMN USER_GROUP.PRIV13 IS  'Privilege 13';
COMMENT ON COLUMN USER_GROUP.PRIV14 IS  'Privilege 14';
COMMENT ON COLUMN USER_GROUP.PRIV15 IS  'Privilege 15';
COMMENT ON COLUMN USER_GROUP.PRIV16 IS  'Privilege 16';
COMMENT ON COLUMN USER_GROUP.PRIV17 IS  'Privilege 17';
COMMENT ON COLUMN USER_GROUP.PRIV18 IS  'Privilege 18';
COMMENT ON COLUMN USER_GROUP.PRIV19 IS  'Privilege 19';
COMMENT ON COLUMN USER_GROUP.PRIV2 IS  'Privilege 2';
COMMENT ON COLUMN USER_GROUP.PRIV20 IS  'Privilege 20';
COMMENT ON COLUMN USER_GROUP.PRIV21 IS  'Privilege 21';
COMMENT ON COLUMN USER_GROUP.PRIV22 IS  'Privilege 22';
COMMENT ON COLUMN USER_GROUP.PRIV23 IS  'Privilege 23';
COMMENT ON COLUMN USER_GROUP.PRIV24 IS  'Privilege 24';
COMMENT ON COLUMN USER_GROUP.PRIV25 IS  'Privilege 25';
COMMENT ON COLUMN USER_GROUP.PRIV26 IS  'Privilege 26';
COMMENT ON COLUMN USER_GROUP.PRIV27 IS  'Privilege 27';
COMMENT ON COLUMN USER_GROUP.PRIV28 IS  'Privilege 28';
COMMENT ON COLUMN USER_GROUP.PRIV29 IS  'Privilege 29';
COMMENT ON COLUMN USER_GROUP.PRIV3 IS  'Privilege 3';
COMMENT ON COLUMN USER_GROUP.PRIV30 IS  'Privilege 30';
COMMENT ON COLUMN USER_GROUP.PRIV31 IS  'Privilege 31';
COMMENT ON COLUMN USER_GROUP.PRIV32 IS  'Privilege 32';
COMMENT ON COLUMN USER_GROUP.PRIV33 IS  'Privilege 33';
COMMENT ON COLUMN USER_GROUP.PRIV34 IS  'Privilege 34';
COMMENT ON COLUMN USER_GROUP.PRIV35 IS  'Privilege 35';
COMMENT ON COLUMN USER_GROUP.PRIV36 IS  'Privilege 36';
COMMENT ON COLUMN USER_GROUP.PRIV37 IS  'Privilege 37';
COMMENT ON COLUMN USER_GROUP.PRIV38 IS  'Privilege 38';
COMMENT ON COLUMN USER_GROUP.PRIV39 IS  'Privilege 39';
COMMENT ON COLUMN USER_GROUP.PRIV4 IS  'Privilege 4';
COMMENT ON COLUMN USER_GROUP.PRIV40 IS  'Privilege 40';
COMMENT ON COLUMN USER_GROUP.PRIV41 IS  'Privilege 41';
COMMENT ON COLUMN USER_GROUP.PRIV42 IS  'Privilege 42';
COMMENT ON COLUMN USER_GROUP.PRIV43 IS  'Privilege 43';
COMMENT ON COLUMN USER_GROUP.PRIV44 IS  'Privilege 44';
COMMENT ON COLUMN USER_GROUP.PRIV45 IS  'Privilege 45';
COMMENT ON COLUMN USER_GROUP.PRIV46 IS  'Privilege 46';
COMMENT ON COLUMN USER_GROUP.PRIV47 IS  'Privilege 47';
COMMENT ON COLUMN USER_GROUP.PRIV48 IS  'Privilege 48';
COMMENT ON COLUMN USER_GROUP.PRIV49 IS  'Privilege 49';
COMMENT ON COLUMN USER_GROUP.PRIV5 IS  'Privilege 5';
COMMENT ON COLUMN USER_GROUP.PRIV50 IS  'Privilege 50';
COMMENT ON COLUMN USER_GROUP.PRIV51 IS  'Privilege 51';
COMMENT ON COLUMN USER_GROUP.PRIV52 IS  'Privilege 52';
COMMENT ON COLUMN USER_GROUP.PRIV53 IS  'Privilege 53';
COMMENT ON COLUMN USER_GROUP.PRIV54 IS  'Privilege 54';
COMMENT ON COLUMN USER_GROUP.PRIV55 IS  'Privilege 55';
COMMENT ON COLUMN USER_GROUP.PRIV56 IS  'Privilege 56';
COMMENT ON COLUMN USER_GROUP.PRIV57 IS  'Privilege 57';
COMMENT ON COLUMN USER_GROUP.PRIV58 IS  'Privilege 58';
COMMENT ON COLUMN USER_GROUP.PRIV59 IS  'Privilege 59';
COMMENT ON COLUMN USER_GROUP.PRIV6 IS  'Privilege 6';
COMMENT ON COLUMN USER_GROUP.PRIV60 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV61 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV62 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV63 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV64 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV65 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV66 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV67 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV68 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV69 IS  'Privilege 60';
COMMENT ON COLUMN USER_GROUP.PRIV7 IS  'Privilege 7';
COMMENT ON COLUMN USER_GROUP.PRIV70 IS  'Privilege 70';
COMMENT ON COLUMN USER_GROUP.PRIV71 IS  'Privilege 71';
COMMENT ON COLUMN USER_GROUP.PRIV72 IS  'Privilege 72';
COMMENT ON COLUMN USER_GROUP.PRIV73 IS  'Privilege 73';
COMMENT ON COLUMN USER_GROUP.PRIV74 IS  'Privilege 74';
COMMENT ON COLUMN USER_GROUP.PRIV75 IS  'Privilege 75';
COMMENT ON COLUMN USER_GROUP.PRIV76 IS  'Privilege 76';
COMMENT ON COLUMN USER_GROUP.PRIV77 IS  'Privilege 77';
COMMENT ON COLUMN USER_GROUP.PRIV78 IS  'Privilege 78';
COMMENT ON COLUMN USER_GROUP.PRIV79 IS  'Privilege 79';
COMMENT ON COLUMN USER_GROUP.PRIV8 IS  'Privilege 8';
COMMENT ON COLUMN USER_GROUP.PRIV80 IS  'Privilege 80';
COMMENT ON COLUMN USER_GROUP.PRIV81 IS  'Privilege 81';
COMMENT ON COLUMN USER_GROUP.PRIV82 IS  'Privilege 82';
COMMENT ON COLUMN USER_GROUP.PRIV83 IS  'Privilege 83';
COMMENT ON COLUMN USER_GROUP.PRIV84 IS  'Privilege 84';
COMMENT ON COLUMN USER_GROUP.PRIV85 IS  'Privilege 85';
COMMENT ON COLUMN USER_GROUP.PRIV86 IS  'Privilege 86';
COMMENT ON COLUMN USER_GROUP.PRIV87 IS  'Privilege 87';
COMMENT ON COLUMN USER_GROUP.PRIV88 IS  'Privilege 88';
COMMENT ON COLUMN USER_GROUP.PRIV89 IS  'Privilege 89';
COMMENT ON COLUMN USER_GROUP.PRIV9 IS  'Privilege 9';
COMMENT ON COLUMN USER_GROUP.PRIV90 IS  'Privilege 90';
COMMENT ON COLUMN USER_GROUP.PRIV91 IS  'Privilege 91';
COMMENT ON COLUMN USER_GROUP.PRIV92 IS  'Privilege 92';
COMMENT ON COLUMN USER_GROUP.PRIV93 IS  'Privilege 93';
COMMENT ON COLUMN USER_GROUP.PRIV94 IS  'Privilege 94';
COMMENT ON COLUMN USER_GROUP.PRIV95 IS  'Privilege 95';
COMMENT ON COLUMN USER_GROUP.PRIV96 IS  'Privilege 96';
COMMENT ON COLUMN USER_GROUP.PRIV97 IS  'Privilege 97';
COMMENT ON COLUMN USER_GROUP.PRIV98 IS  'Privilege 98';
COMMENT ON COLUMN USER_GROUP.PRIV99 IS  'Privilege 99';
COMMENT ON COLUMN USER_GROUP.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN USER_GROUP.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN USER_GROUP.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN USER_GROUP.CUSER IS 'The user who created the row';
COMMENT ON COLUMN USER_GROUP.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN USER_GROUP.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN USER_GROUP.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN USER_GROUP.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN USER_GROUP.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

