ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/DBS/Schema/RefDBLegacy/OracleFiles.sql
(Generate patch)

Comparing COMP/DBS/Schema/RefDBLegacy/OracleFiles.sql (file contents):
Revision 1.2 by lat, Thu Oct 6 21:41:38 2005 UTC vs.
Revision 1.6 by lat, Thu Oct 27 16:57:38 2005 UTC

# Line 1 | Line 1
1   -- ======================================================================
2 + create sequence seq_block_status;
3 + create sequence seq_block;
4   create sequence seq_file_status;
5   create sequence seq_file_type;
6   create sequence seq_file;
7   create sequence seq_evcoll_file;
8  
9   -- ======================================================================
10 + create table t_block_status
11 +  (id                           integer         not null,
12 +   name                         varchar (1000)  not null);
13 +
14 + create table t_block
15 +  (id                           integer         not null,
16 +   processed_dataset            integer         not null,
17 +   status                       integer         not null,
18 +   files                        integer         not null,
19 +   bytes                        integer         not null);
20 +
21   create table t_file_status
22    (id                           integer         not null,
23 <   name                         varchar (1000)  not null,
11 <   created_at                   float           not null,
12 <   created_by                   integer         not null,
13 <   modified_at                  float           not null,
14 <   modified_by                  integer         not null);
23 >   name                         varchar (1000)  not null);
24  
25   create table t_file_type
26    (id                           integer         not null,
27 <   name                         varchar (1000)  not null,
19 <   created_at                   float           not null,
20 <   created_by                   integer         not null,
21 <   modified_at                  float           not null,
22 <   modified_by                  integer         not null);
27 >   name                         varchar (1000)  not null);
28  
29   create table t_file
30    (id                           integer         not null,
31 +   guid                         varchar (1000)  /* not null */,
32     logical_name                 varchar (1000)  not null,
33 <   checksum                     varchar (1000)  not null,
34 <   filesize                     varchar (1000)  not null,
35 <   status                       integer         not null,
33 >   checksum                     varchar (1000)  /* not null */,
34 >   filesize                     integer         /* not null */,
35 >   status                       integer         /* not null */,
36     type                         integer         not null,
37 <   created_at                   float           not null,
32 <   created_by                   integer         not null,
33 <   modified_at                  float           not null,
34 <   modified_by                  integer         not null);
37 >   inblock                      integer         not null);
38  
39   create table t_evcoll_file
40    (id                           integer         not null,
41     evcoll                       integer         not null,
42 <   fileid                       integer         not null,
40 <   created_at                   float           not null,
41 <   created_by                   integer         not null,
42 <   modified_at                  float           not null,
43 <   modified_by                  integer         not null);
42 >   fileid                       integer         not null);
43  
44   -- ======================================================================
45 < alter table t_file_status
46 <  add constraint pk_file_status
45 > alter table t_block_status
46 >  add constraint pk_block_status
47    primary key (id)
48    using index tablespace CMS_DBS_INDX01;
49  
50 < alter table t_file_status
51 <  add constraint uq_file_status_key
50 > alter table t_block_status
51 >  add constraint uq_block_status_key
52    unique (name);
53  
54 + --
55 + alter table t_block
56 +  add constraint pk_block
57 +  primary key (id)
58 +  using index tablespace CMS_DBS_INDX01;
59 +
60 + alter table t_block
61 +  add constraint fk_block_status
62 +  foreign key (status) references t_block_status (id);
63 +
64 + --
65   alter table t_file_status
66 <  add constraint fk_file_status_creat
67 <  foreign key (created_by) references t_person (id);
66 >  add constraint pk_file_status
67 >  primary key (id)
68 >  using index tablespace CMS_DBS_INDX01;
69  
70   alter table t_file_status
71 <  add constraint fk_file_status_mod
72 <  foreign key (modified_by) references t_person (id);
71 >  add constraint uq_file_status_key
72 >  unique (name);
73  
74   --
75   alter table t_file_type
# Line 70 | Line 81 | alter table t_file_type
81    add constraint uq_file_type
82    unique (name);
83  
73 alter table t_file_type
74  add constraint fk_file_type_creat
75  foreign key (created_by) references t_person (id);
76
77 alter table t_file_type
78  add constraint fk_file_type_mod
79  foreign key (modified_by) references t_person (id);
80
84   --
85   alter table t_file
86    add constraint pk_file
# Line 97 | Line 100 | alter table t_file
100    foreign key (type) references t_file_type (id);
101  
102   alter table t_file
103 <  add constraint fk_file_creat
104 <  foreign key (created_by) references t_person (id);
102 <
103 < alter table t_file
104 <  add constraint fk_file_mod
105 <  foreign key (modified_by) references t_person (id);
103 >  add constraint fk_file_inblock
104 >  foreign key (status) references t_block (id);
105  
106   --
107   alter table t_evcoll_file
# Line 117 | Line 116 | alter table t_evcoll_file
116   alter table t_evcoll_file
117    add constraint fk_evcoll_file_evcoll
118    foreign key (evcoll) references t_event_collection (id)
119 <  /* on upfloat cascade */ on delete cascade;
119 >  /* on update cascade */ on delete cascade;
120  
121   alter table t_evcoll_file
122    add constraint fk_evcoll_file_fileid
123    foreign key (fileid) references t_file (id);
124  
126 alter table t_evcoll_file
127  add constraint fk_evcoll_file_creat
128  foreign key (created_by) references t_person (id);
129
130 alter table t_evcoll_file
131  add constraint fk_evcoll_file_mod
132  foreign key (modified_by) references t_person (id);
133
125   -- ======================================================================
126 < create index ix_file_status_creat
127 <  on t_file_status (created_by)
137 <  tablespace CMS_DBS_INDX01;
138 <
139 < create index ix_file_status_mod
140 <  on t_file_status (modified_by)
141 <  tablespace CMS_DBS_INDX01;
142 <
143 < --
144 < create index ix_file_type_creat
145 <  on t_file_type (created_by)
146 <  tablespace CMS_DBS_INDX01;
147 <
148 < create index ix_file_type_mod
149 <  on t_file_type (modified_by)
126 > create index ix_block_status
127 >  on t_block (status)
128    tablespace CMS_DBS_INDX01;
129  
130   --
# Line 158 | Line 136 | create index ix_file_type
136    on t_file (type)
137    tablespace CMS_DBS_INDX01;
138  
139 < create index ix_file_creat
140 <  on t_file (created_by)
163 <  tablespace CMS_DBS_INDX01;
164 <
165 < create index ix_file_mod
166 <  on t_file (modified_by)
167 <  tablespace CMS_DBS_INDX01;
168 <
169 < --
170 < create index ix_evcoll_file_creat
171 <  on t_evcoll_file (created_by)
172 <  tablespace CMS_DBS_INDX01;
173 <
174 < create index ix_evcoll_file_mod
175 <  on t_evcoll_file (modified_by)
139 > create index ix_file_inblock
140 >  on t_file (inblock)
141    tablespace CMS_DBS_INDX01;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines