/
update-5.27-mysql.sql
39 lines (34 loc) · 1.67 KB
/
update-5.27-mysql.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- part 1: can be applied on archive running archive 5.25
alter table hl7psu_task
add accession_no varchar(255);
create table instance_req (
pk bigint not null auto_increment,
accession_no varchar(255) not null,
accno_entity_id varchar(255),
accno_entity_uid varchar(255),
accno_entity_uid_type varchar(255),
req_proc_id varchar(255) not null,
req_service varchar(255) not null,
sps_id varchar(255) not null,
study_iuid varchar(255) not null,
req_phys_name_fk bigint,
instance_fk bigint,
primary key (pk));
alter table instance_req
add constraint FK_cqmmps9maltjybl44t4cck404 foreign key (req_phys_name_fk) references person_name (pk);
alter table instance_req
add constraint FK_47n586hkafgp9m1etqohgfybl foreign key (instance_fk) references instance (pk);
alter table series
add modified_time datetime;
update series set modified_time = updated_time;
create index UK_cqpv94ky100d0eguhrxpyplmv on instance_req (accession_no(64));
create index UK_n32ktg5h9xc1ex9x8g69w1s10 on instance_req (req_service(64));
create index UK_7pudwdgrg9wwc73wo65hpg517 on instance_req (req_proc_id(64));
create index UK_43h9ogidkcnex0e14q6u0c3jn on instance_req (sps_id(64));
create index UK_1typgaxhn4d0pt1f0vlp18wvb on instance_req (study_iuid(64));
create index FK_cqmmps9maltjybl44t4cck404 on instance_req (req_phys_name_fk) ;
create index FK_47n586hkafgp9m1etqohgfybl on instance_req (instance_fk) ;
-- part 2: shall be applied on stopped archive before starting 5.26
update series set modified_time = updated_time where modified_time is null;
-- part 3: can be applied on already running archive 5.26
alter table series modify modified_time datetime not null;