From b022a738ec49323ff414cdb4b4e7f48bbc9a0237 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:12:53 -0400 Subject: [PATCH] Added database migration --- .../V1.24.0__experiment_program_user.sql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/resources/db/migration/V1.24.0__experiment_program_user.sql diff --git a/src/main/resources/db/migration/V1.24.0__experiment_program_user.sql b/src/main/resources/db/migration/V1.24.0__experiment_program_user.sql new file mode 100644 index 000000000..c84ebf9f4 --- /dev/null +++ b/src/main/resources/db/migration/V1.24.0__experiment_program_user.sql @@ -0,0 +1,27 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +-- experiment_id is not tracked in bidb as seperate experiment entities, only in this linking table +CREATE TABLE experiment_program_user_role ( + like base_entity INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES, + experiment_id UUID NOT NULL, + program_user_role_id UUID NOT NULL, + like base_edit_track_entity INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES +); +ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (created_by) REFERENCES bi_user (id); +ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (updated_by) REFERENCES bi_user (id); +ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (program_user_role_id) REFERENCES program_user_role (id); \ No newline at end of file