From 371aaf3e8d60c2d673c0befd44d2e9c969a20f34 Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Thu, 15 Oct 2020 18:32:09 +0200 Subject: [PATCH] OO-4971: update alter and setup for MySQL and Oracle --- .../database/mysql/alter_15_2_x_to_15_3_0.sql | 72 +++++++++---------- .../oracle/alter_15_2_x_to_15_3_0.sql | 10 +-- .../oracle/alter_15_pre_7_to_15_pre_8.sql | 4 +- .../database/oracle/setupDatabase.sql | 53 +++++++------- 4 files changed, 70 insertions(+), 69 deletions(-) diff --git a/src/main/resources/database/mysql/alter_15_2_x_to_15_3_0.sql b/src/main/resources/database/mysql/alter_15_2_x_to_15_3_0.sql index 2eee3ff4500..cca46347424 100644 --- a/src/main/resources/database/mysql/alter_15_2_x_to_15_3_0.sql +++ b/src/main/resources/database/mysql/alter_15_2_x_to_15_3_0.sql @@ -81,12 +81,12 @@ alter table o_ap_appointment add constraint ap_appointment_meeting_idx foreign k -- Organiation role rights create table o_org_role_to_right ( - id bigint not null auto_increment, - creationdate datetime not null, - o_role varchar(255) not null, - o_right varchar(255) not null, - fk_organisation bigint not null, - primary key (id) + id bigint not null auto_increment, + creationdate datetime not null, + o_role varchar(255) not null, + o_right varchar(255) not null, + fk_organisation bigint not null, + primary key (id) ); alter table o_org_role_to_right add constraint org_role_to_right_to_organisation_idx foreign key (fk_organisation) references o_org_organisation (id); @@ -101,37 +101,37 @@ alter table o_lecture_absence_category add column l_enabled bool default true no -- Contact tracing create table o_contact_tracing_location ( - id bigserial, - creationdate timestamp not null, - lastmodified timestamp not null, - l_reference varchar(255) not null, - l_titel varchar(255) not null, - l_room varchar(255) not null, - l_building varchar(255) not null, - l_qr_id varchar(255) not null, - l_guests boolean not null, - primary key (id) + id bigint not null auto_increment, + creationdate datetime not null, + lastmodified datetime not null, + l_reference varchar(255) not null, + l_titel varchar(255) not null, + l_room varchar(255) not null, + l_building varchar(255) not null, + l_qr_id varchar(255) not null, + l_guests boolean not null, + primary key (id) ); create table o_contact_tracing_entry ( - id bigserial, - creationdate timestamp not null, - l_deletion_date timestamp not null, - l_start_date timestamp not null, - l_end_date timestamp, - l_nick_name varchar(255), - l_fist_name varchar(255), - l_last_name varchar(255), - l_street varchar(255), - l_extra_line varchar(255), - l_zip_code varchar(255), - l_city varchar(255), - l_email varchar(255), - l_institutional_email varchar(255), - l_generic_email varchar(255), - l_private_phone varchar(255), - l_mobile_phone varchar(255), - l_office_phone varchar(255), - fk_location int8 not null, - primary key (id) + id bigint not null auto_increment, + creationdate datetime not null, + l_deletion_date datetime not null, + l_start_date datetime not null, + l_end_date datetime, + l_nick_name varchar(255), + l_fist_name varchar(255), + l_last_name varchar(255), + l_street varchar(255), + l_extra_line varchar(255), + l_zip_code varchar(255), + l_city varchar(255), + l_email varchar(255), + l_institutional_email varchar(255), + l_generic_email varchar(255), + l_private_phone varchar(255), + l_mobile_phone varchar(255), + l_office_phone varchar(255), + fk_location int8 not null, + primary key (id) ); diff --git a/src/main/resources/database/oracle/alter_15_2_x_to_15_3_0.sql b/src/main/resources/database/oracle/alter_15_2_x_to_15_3_0.sql index fa8271ec981..3d26a1b9f1f 100644 --- a/src/main/resources/database/oracle/alter_15_2_x_to_15_3_0.sql +++ b/src/main/resources/database/oracle/alter_15_2_x_to_15_3_0.sql @@ -88,8 +88,8 @@ create table o_org_role_to_right ( primary key (id) ); -alter table o_org_role_to_right add constraint org_role_to_right_to_organisation_idx foreign key (fk_organisation) references o_org_organisation (id); -create index idx_org_role_to_right_to_organisation_idx on o_org_role_to_right(fk_organisation); +alter table o_org_role_to_right add constraint org_role_to_right_to_org_idx foreign key (fk_organisation) references o_org_organisation (id); +create index idx_org_role_to_r_to_org_idx on o_org_role_to_right(fk_organisation); -- Lectures @@ -100,7 +100,7 @@ alter table o_lecture_absence_category add l_enabled number default 1 not null; -- Contact tracing create table o_contact_tracing_location ( - id number(20) generated always as identity , + id number(20) generated always as identity, creationdate date not null, lastmodified date not null, l_reference varchar2(255) not null, @@ -108,12 +108,12 @@ create table o_contact_tracing_location ( l_room varchar2(255) not null, l_building varchar2(255) not null, l_qr_id varchar2(255) not null, - l_guests boolean not null, + l_guests number not null, primary key (id) ); create table o_contact_tracing_entry ( - id bigserial, + id number(20) generated always as identity, creationdate date not null, l_deletion_date date not null, l_start_date date not null, diff --git a/src/main/resources/database/oracle/alter_15_pre_7_to_15_pre_8.sql b/src/main/resources/database/oracle/alter_15_pre_7_to_15_pre_8.sql index 5f44393fe2a..5fa974ed644 100644 --- a/src/main/resources/database/oracle/alter_15_pre_7_to_15_pre_8.sql +++ b/src/main/resources/database/oracle/alter_15_pre_7_to_15_pre_8.sql @@ -13,8 +13,8 @@ drop table o_ep_struct_el; -- Course disclaimer create table o_course_disclaimer_consent( id number(20) generated always as identity, - disc_1_accepted boolean not null, - disc_2_accepted boolean not null, + disc_1_accepted number not null, + disc_2_accepted number not null, creationdate timestamp not null, lastmodified timestamp not null, fk_repository_entry number(20) not null, diff --git a/src/main/resources/database/oracle/setupDatabase.sql b/src/main/resources/database/oracle/setupDatabase.sql index 2b0b16c6ad2..de0f8880725 100644 --- a/src/main/resources/database/oracle/setupDatabase.sql +++ b/src/main/resources/database/oracle/setupDatabase.sql @@ -3184,8 +3184,8 @@ create table o_grad_configuration ( -- course disclaimer create table o_course_disclaimer_consent( id number(20) generated always as identity, - disc_1_accepted boolean not null, - disc_2_accepted boolean not null, + disc_1_accepted number not null, + disc_2_accepted number not null, creationdate timestamp not null, lastmodified timestamp not null, fk_repository_entry number(20) not null, @@ -3264,7 +3264,7 @@ create table o_org_role_to_right ( -- Contact tracing create table o_contact_tracing_location ( - id number(20) generated always as identity , + id number(20) generated always as identity, creationdate date not null, lastmodified date not null, l_reference varchar2(255) not null, @@ -3272,33 +3272,34 @@ create table o_contact_tracing_location ( l_room varchar2(255) not null, l_building varchar2(255) not null, l_qr_id varchar2(255) not null, - l_guests boolean not null, + l_guests number not null, primary key (id) ); create table o_contact_tracing_entry ( - id bigserial, - creationdate date not null, - l_deletion_date date not null, - l_start_date date not null, - l_end_date date, - l_nick_name varchar2(255), - l_fist_name varchar2(255), - l_last_name varchar2(255), - l_street varchar2(255), - l_extra_line varchar2(255), - l_zip_code varchar2(255), - l_city varchar2(255), - l_email varchar2(255), - l_institutional_email varchar2(255), - l_generic_email varchar2(255), - l_private_phone varchar2(255), - l_mobile_phone varchar2(255), - l_office_phone varchar2(255), - fk_location number(20) not null, - primary key (id) + id number(20) generated always as identity, + creationdate date not null, + l_deletion_date date not null, + l_start_date date not null, + l_end_date date, + l_nick_name varchar2(255), + l_fist_name varchar2(255), + l_last_name varchar2(255), + l_street varchar2(255), + l_extra_line varchar2(255), + l_zip_code varchar2(255), + l_city varchar2(255), + l_email varchar2(255), + l_institutional_email varchar2(255), + l_generic_email varchar2(255), + l_private_phone varchar2(255), + l_mobile_phone varchar2(255), + l_office_phone varchar2(255), + fk_location number(20) not null, + primary key (id) ); + -- user view create view o_bs_identity_short_v as ( select @@ -4498,8 +4499,8 @@ insert into o_stat_lastupdated (until_datetime, from_datetime, lastupdated) valu insert into hibernate_unique_key values ( 0 ); -- Organiation role rights -alter table o_org_role_to_right add constraint org_role_to_right_to_organisation_idx foreign key (fk_organisation) references o_org_organisation (id); -create index idx_org_role_to_right_to_organisation_idx on o_org_role_to_right(fk_organisation); +alter table o_org_role_to_right add constraint org_role_to_right_to_org_idx foreign key (fk_organisation) references o_org_organisation (id); +create index idx_org_role_to_r_to_org_idx on o_org_role_to_right(fk_organisation); commit -- GitLab