Signed-off-by: Amolith <amolith@secluded.site>
---
deploy/tel_inventory.sql | 18 ++++++++++++++++++
revert/tel_inventory.sql | 7 +++++++
sqitch.plan | 2 ++
verify/tel_inventory.sql | 15 +++++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 deploy/tel_inventory.sql
create mode 100644 revert/tel_inventory.sql
create mode 100644 verify/tel_inventory.sql
diff --git a/deploy/tel_inventory.sql b/deploy/tel_inventory.sql
new file mode 100644
index 0000000..76fc583
--- /dev/null
+++ b/deploy/tel_inventory.sql
@@ -0,0 +1,18 @@
+-- Deploy jmp:tel_inventory to pg
+
+BEGIN;
+
+CREATE TABLE tel_inventory (
+ tel TEXT PRIMARY KEY,
+ locality TEXT NOT NULL,
+ region TEXT NOT NULL,
+ bandwidth_site_id TEXT NOT NULL,
+ premium_price NUMERIC NOT NULL DEFAULT 0,
+ available_after TIMESTAMP NOT NULL DEFAULT NOW(),
+ purchased_at TIMESTAMP NOT NULL DEFAULT NOW(),
+);
+
+CREATE INDEX ON tel_inventory (locality, available_after);
+CREATE INDEX ON tel_inventory (region, available_after);
+
+COMMIT;
diff --git a/revert/tel_inventory.sql b/revert/tel_inventory.sql
new file mode 100644
index 0000000..708b9c4
--- /dev/null
+++ b/revert/tel_inventory.sql
@@ -0,0 +1,7 @@
+-- Revert jmp:tel_inventory from pg
+
+BEGIN;
+
+DROP TABLE tel_inventory;
+
+COMMIT;
diff --git a/sqitch.plan b/sqitch.plan
index 20c9330..e415ef5 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -60,3 +60,5 @@ cdr_with_charge_ignoring_failed_noanswer [cdr_with_charge] 2023-03-28T21:35:43Z
customer_plans_with_pending [plan_log customer_plans parent_customer_id plan_log_with_range] 2023-05-03T15:05:21Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Add pending boolean to the customer_plans view
@2023123 2023-05-03T15:20:20Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Deploy customer_plans.pending
+
+tel_inventory 2023-09-18T17:54:30Z Amolith <amolith@secluded.site> # Add schema for tel inventory system
diff --git a/verify/tel_inventory.sql b/verify/tel_inventory.sql
new file mode 100644
index 0000000..15a05bc
--- /dev/null
+++ b/verify/tel_inventory.sql
@@ -0,0 +1,15 @@
+-- Verify jmp:tel_inventory on pg
+
+BEGIN;
+
+SELECT
+ tel,
+ locality,
+ region,
+ bandwidth_site_id,
+ premium_price,
+ available_after,
+ purchased_at
+FROM tel_inventory;
+
+ROLLBACK;
--
2.42.0