From aee09cf9337a98e07f7766449f396da8a3f77009 Mon Sep 17 00:00:00 2001 From: Sarah Roberts Date: Mon, 27 Mar 2023 16:17:45 -0700 Subject: [PATCH] CORE-1890: increase CPU hour quotas by a factor of 10 --- migrations/000011_cpu_hours_increase.down.sql | 25 +++++++++++++++++++ migrations/000011_cpu_hours_increase.up.sql | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 migrations/000011_cpu_hours_increase.down.sql create mode 100644 migrations/000011_cpu_hours_increase.up.sql diff --git a/migrations/000011_cpu_hours_increase.down.sql b/migrations/000011_cpu_hours_increase.down.sql new file mode 100644 index 0000000..dab13b3 --- /dev/null +++ b/migrations/000011_cpu_hours_increase.down.sql @@ -0,0 +1,25 @@ +-- +-- Decreases the number of CPU hours available to users by a factor of 10. +-- + +BEGIN; + +SET search_path = public, pg_catalog; + +-- Divide the number of CPU hours for each subscription plan by 10. +UPDATE plan_quota_defaults +SET quota_value = CAST(quota_value / 10 AS bigint) +WHERE resource_type_id = ( + SELECT id FROM resource_types + WHERE name = 'cpu.hours' +); + +-- Divide the number of CPU hours for each subscription by 10. +UPDATE quotas +SET quota = CAST(quota / 10 AS bigint) +WHERE resource_type_id = ( + SELECT id FROM resource_types + WHERE name = 'cpu.hours' +); + +COMMIT; diff --git a/migrations/000011_cpu_hours_increase.up.sql b/migrations/000011_cpu_hours_increase.up.sql new file mode 100644 index 0000000..79b3172 --- /dev/null +++ b/migrations/000011_cpu_hours_increase.up.sql @@ -0,0 +1,25 @@ +-- +-- Increases the number of CPU hours available to users by a factor of 10. +-- + +BEGIN; + +SET search_path = public, pg_catalog; + +-- Multiply the number of CPU hours for each subscription plan by 10. +UPDATE plan_quota_defaults +SET quota_value = quota_value * 10 +WHERE resource_type_id = ( + SELECT id FROM resource_types + WHERE name = 'cpu.hours' +); + +-- Multiply the number of CPU hours for each subscription by 10. +UPDATE quotas +SET quota = quota * 10 +WHERE resource_type_id = ( + SELECT id FROM resource_types + WHERE name = 'cpu.hours' +); + +COMMIT;