From 4f85961434061d8a36be9d7528e5a0171a07d3ba Mon Sep 17 00:00:00 2001 From: ShobhitSingh11 <139750384+ShobhitSingh11@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:26:51 +0530 Subject: [PATCH] fix: [CI-15948]: Changing build_deploy_id to BIG INT (#3618) --- store/shared/migrate/postgres/ddl_gen.go | 10 ++++++++++ .../files/020_amend_column_builds_deploy_id.sql | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 store/shared/migrate/postgres/files/020_amend_column_builds_deploy_id.sql diff --git a/store/shared/migrate/postgres/ddl_gen.go b/store/shared/migrate/postgres/ddl_gen.go index d87aaf501..be994fc9e 100644 --- a/store/shared/migrate/postgres/ddl_gen.go +++ b/store/shared/migrate/postgres/ddl_gen.go @@ -200,6 +200,10 @@ var migrations = []struct { name: "create-new-table-cards", stmt: createNewTableCards, }, + { + name: "alter-table-builds-alter-column-deploy-id", + stmt: alterTableBuildsAlterColumnDeployId, + }, } // Migrate performs the database migration. If the migration fails @@ -769,3 +773,9 @@ CREATE TABLE IF NOT EXISTS cards FOREIGN KEY (card_id) REFERENCES steps (step_id) ON DELETE CASCADE ); ` +var alterTableBuildsAlterColumnDeployId = ` +ALTER TABLE builds +ALTER COLUMN build_deploy_id SET DATA TYPE BIGINT, +ALTER COLUMN build_deploy_id SET NOT NULL, +ALTER COLUMN build_deploy_id SET DEFAULT 0; +` diff --git a/store/shared/migrate/postgres/files/020_amend_column_builds_deploy_id.sql b/store/shared/migrate/postgres/files/020_amend_column_builds_deploy_id.sql new file mode 100644 index 000000000..ad37a93e7 --- /dev/null +++ b/store/shared/migrate/postgres/files/020_amend_column_builds_deploy_id.sql @@ -0,0 +1,4 @@ +ALTER TABLE builds +ALTER COLUMN build_deploy_id SET DATA TYPE BIGINT, +ALTER COLUMN build_deploy_id SET NOT NULL, +ALTER COLUMN build_deploy_id SET DEFAULT 0; \ No newline at end of file