From 295b304b0e193e4deff357ea94dd5bfed3d4130e Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 11 Jun 2024 08:41:27 -1000 Subject: [PATCH 1/2] Added a default value to sequence adaptation names so migrations dont break --- .../migrations/Aerie/5_sequence_adaptation_name/down.sql | 2 +- .../hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql | 4 ++-- .../sql/tables/sequencing/sequence_adaptation.sql | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql index 8ea7897d50..8ca894c629 100644 --- a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql +++ b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql @@ -1,5 +1,5 @@ alter table sequencing.sequence_adaptation - drop constraint sequence_adaptation_natural_key, + drop constraint sequence_adaptation_unique_key, drop column name; call migrations.mark_migration_rolled_back('5'); diff --git a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql index 81a838d040..069754488f 100644 --- a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql +++ b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql @@ -1,6 +1,6 @@ alter table sequencing.sequence_adaptation - add column name text not null, - add constraint sequence_adaptation_natural_key + add column name text not null default gen_random_uuid(), + add constraint sequence_adaptation_unique_key unique (name); comment on column sequencing.sequence_adaptation.name is e'' diff --git a/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql b/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql index e97350a9bf..e3a1748f79 100644 --- a/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql +++ b/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql @@ -1,7 +1,7 @@ create table sequencing.sequence_adaptation ( id integer generated always as identity, adaptation text not null, - name text not null, + name text not null default gen_random_uuid(), created_at timestamptz not null default now(), owner text, updated_at timestamptz not null default now(), @@ -9,7 +9,7 @@ create table sequencing.sequence_adaptation ( constraint sequence_adaptation_synthetic_key primary key (id), - constraint sequence_adaptation_natural_key + constraint sequence_adaptation_unique_key unique (name), foreign key (owner) references permissions.users From d586b2d7de6252471f0530fec954cd076de2f0f5 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 11 Jun 2024 10:44:15 -1000 Subject: [PATCH 2/2] Renamed sequence adaptation name unique constraint --- .../hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql | 2 +- .../hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql | 2 +- .../sql/tables/sequencing/sequence_adaptation.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql index 8ca894c629..261f2d5c41 100644 --- a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql +++ b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/down.sql @@ -1,5 +1,5 @@ alter table sequencing.sequence_adaptation - drop constraint sequence_adaptation_unique_key, + drop constraint sequence_adaptation_name_unique_key, drop column name; call migrations.mark_migration_rolled_back('5'); diff --git a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql index 069754488f..36978f69f4 100644 --- a/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql +++ b/deployment/hasura/migrations/Aerie/5_sequence_adaptation_name/up.sql @@ -1,6 +1,6 @@ alter table sequencing.sequence_adaptation add column name text not null default gen_random_uuid(), - add constraint sequence_adaptation_unique_key + add constraint sequence_adaptation_name_unique_key unique (name); comment on column sequencing.sequence_adaptation.name is e'' diff --git a/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql b/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql index e3a1748f79..5272f99056 100644 --- a/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql +++ b/deployment/postgres-init-db/sql/tables/sequencing/sequence_adaptation.sql @@ -9,7 +9,7 @@ create table sequencing.sequence_adaptation ( constraint sequence_adaptation_synthetic_key primary key (id), - constraint sequence_adaptation_unique_key + constraint sequence_adaptation_name_unique_key unique (name), foreign key (owner) references permissions.users