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;