1 |
-- ======================================================================
|
2 |
create sequence seq_run_quality;
|
3 |
create sequence seq_run;
|
4 |
create sequence seq_evcoll_run;
|
5 |
|
6 |
-- ======================================================================
|
7 |
create table t_run_quality
|
8 |
(id integer not null,
|
9 |
name varchar (1000) not null);
|
10 |
|
11 |
create table t_run
|
12 |
(id integer not null,
|
13 |
run_number integer not null,
|
14 |
run_quality integer not null);
|
15 |
|
16 |
create table t_evcoll_run
|
17 |
(event_collection integer not null,
|
18 |
run integer not null);
|
19 |
|
20 |
-- ======================================================================
|
21 |
alter table t_run_quality
|
22 |
add constraint pk_run_quality
|
23 |
primary key (id)
|
24 |
using index tablespace CMS_DBS_INDX01;
|
25 |
|
26 |
alter table t_run_quality
|
27 |
add constraint uq_run_quality_name
|
28 |
unique (name);
|
29 |
|
30 |
--
|
31 |
alter table t_run
|
32 |
add constraint pk_run
|
33 |
primary key (id)
|
34 |
using index tablespace CMS_DBS_INDX01;
|
35 |
|
36 |
alter table t_run
|
37 |
add constraint uq_run_number
|
38 |
unique (run_number);
|
39 |
|
40 |
alter table t_run
|
41 |
add constraint fk_run_quality
|
42 |
foreign key (run_quality) references t_run_quality (id);
|
43 |
|
44 |
--
|
45 |
alter table t_evcoll_run
|
46 |
add constraint pk_evcoll_run
|
47 |
primary key (event_collection, run)
|
48 |
using index tablespace CMS_DBS_INDX01;
|
49 |
|
50 |
alter table t_evcoll_run
|
51 |
add constraint fk_evcoll_run_evcoll
|
52 |
foreign key (event_collection) references t_event_collection (id);
|
53 |
|
54 |
alter table t_evcoll_run
|
55 |
add constraint fk_evcoll_run_run
|
56 |
foreign key (run) references t_run (id);
|