From 2f51bb8da8d997a78dac1e6eafc8f3f1dd754a4c Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Tue, 6 Aug 2024 21:55:48 +0000 Subject: [PATCH] fix(cluster): split up backfill query from schema change --- .../migrations/20240701225245_add_json.up.sql | 24 ------------------- .../20240806214514_provider_backfill.down.sql | 0 .../20240806214514_provider_backfill.up.sql | 24 +++++++++++++++++++ 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.down.sql create mode 100644 svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.up.sql diff --git a/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql b/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql index aa8b71c245..0d2860dadc 100644 --- a/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql +++ b/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql @@ -26,27 +26,3 @@ CREATE TABLE server_images2 ( PRIMARY KEY (provider, install_hash, datacenter_id, pool_type) ); --- Backfill -UPDATE datacenters -SET provider2 = '"Linode"' -WHERE provider = 0; - -UPDATE servers -SET pool_type2 = '"Job"' -WHERE pool_type = 0; -UPDATE servers -SET pool_type2 = '"Gg"' -WHERE pool_type = 1; -UPDATE servers -SET pool_type2 = '"Ats"' -WHERE pool_type = 2; - -UPDATE datacenter_tls -SET state2 = '"Creating"' -WHERE state = 0; -UPDATE datacenter_tls -SET state2 = '"Active"' -WHERE state = 1; -UPDATE datacenter_tls -SET state2 = '"Renewing"' -WHERE state = 2; diff --git a/svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.down.sql b/svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.down.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.up.sql b/svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.up.sql new file mode 100644 index 0000000000..6caa8cdcb4 --- /dev/null +++ b/svc/pkg/cluster/db/cluster/migrations/20240806214514_provider_backfill.up.sql @@ -0,0 +1,24 @@ +-- Backfill +UPDATE datacenters +SET provider2 = '"Linode"' +WHERE provider = 0; + +UPDATE servers +SET pool_type2 = '"Job"' +WHERE pool_type = 0; +UPDATE servers +SET pool_type2 = '"Gg"' +WHERE pool_type = 1; +UPDATE servers +SET pool_type2 = '"Ats"' +WHERE pool_type = 2; + +UPDATE datacenter_tls +SET state2 = '"Creating"' +WHERE state = 0; +UPDATE datacenter_tls +SET state2 = '"Active"' +WHERE state = 1; +UPDATE datacenter_tls +SET state2 = '"Renewing"' +WHERE state = 2;