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