From ede00c77d673d89e9f0eb9d8cceba991604ea631 Mon Sep 17 00:00:00 2001 From: Sarah Roberts Date: Thu, 23 Jan 2025 14:57:38 -0700 Subject: [PATCH] CORE-2016: added a conversion for the CPU hour addon --- migrations/000016_cpu_hour_addon.down.sql | 11 +++++++++++ migrations/000016_cpu_hour_addon.up.sql | 24 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 migrations/000016_cpu_hour_addon.down.sql create mode 100644 migrations/000016_cpu_hour_addon.up.sql diff --git a/migrations/000016_cpu_hour_addon.down.sql b/migrations/000016_cpu_hour_addon.down.sql new file mode 100644 index 0000000..9b698cf --- /dev/null +++ b/migrations/000016_cpu_hour_addon.down.sql @@ -0,0 +1,11 @@ +-- +-- Deletes the add-on for cpu-hour-only subscriptions. +-- + +BEGIN; + +SET search_path = public, pg_catalog; + +DELETE FROM addons WHERE id = 'f8d2066c-e3b2-4559-839e-88bfc997c89f'; + +COMMIT; diff --git a/migrations/000016_cpu_hour_addon.up.sql b/migrations/000016_cpu_hour_addon.up.sql new file mode 100644 index 0000000..0267adc --- /dev/null +++ b/migrations/000016_cpu_hour_addon.up.sql @@ -0,0 +1,24 @@ +-- +-- Creates an add-on for cpu-hour-only subscriptions. +-- + +BEGIN; + +SET search_path = public, pg_catalog; + +INSERT INTO addons (id, name, description, resource_type_id, default_amount, default_paid) +VALUES ( + 'f8d2066c-e3b2-4559-839e-88bfc997c89f', + '5000 CPU Hours', + '5000 CPU Hours to be used before the current subscription ends..', + (SELECT id FROM resource_types WHERE name = 'cpu.hours'), + 5000, + TRUE +) +ON CONFLICT DO NOTHING; + +INSERT INTO addon_rates (id, addon_id, effective_date, rate) VALUES +('672e49af-b7b7-4a0e-a929-00f4a1c5e7f2', 'f8d2066c-e3b2-4559-839e-88bfc997c89f', '2025-01-01', 100.00) +ON CONFLICT (id) DO NOTHING; + +COMMIT;