~singpolyma/dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH jmp-schemas v2] Add schema for tel_inventory #320

Details
Message ID
<20230918192455.499898-1-amolith@secluded.site>
DKIM signature
pass
Download raw message
Patch: +41 -0
Signed-off-by: Amolith <amolith@secluded.site>
---

The tel column is now a PRIMARY KEY so NOT NULL is no longer necessary there as
primary keys are NOT NULL by default. I added indexes for locality, region, and
available_after and removed the WHERE clause from the verify script.

 deploy/tel_inventory.sql | 17 +++++++++++++++++
 revert/tel_inventory.sql |  7 +++++++
 sqitch.plan              |  2 ++
 verify/tel_inventory.sql | 15 +++++++++++++++
 4 files changed, 41 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..81ec24a
--- /dev/null
+++ b/deploy/tel_inventory.sql
@@ -0,0 +1,17 @@
-- 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 (tel, locality, 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

[jmp-schemas/patches/debian-stable.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CVMAFZ6XXG7E.24R1DYP5ZRLOF@cirno2>
In-Reply-To
<20230918192455.499898-1-amolith@secluded.site> (view parent)
DKIM signature
missing
Download raw message
jmp-schemas/patches/debian-stable.yml: FAILED in 17s

[Add schema for tel_inventory #320][0] v2 from [Amolith][1]

[0]: https://lists.sr.ht/~singpolyma/dev/patches/44848
[1]: amolith@secluded.site

✗ #1059444 FAILED jmp-schemas/patches/debian-stable.yml https://builds.sr.ht/~singpolyma/job/1059444
Details
Message ID
<ZQikzF7GVs8djhqD@singpolyma-beefy.lan>
In-Reply-To
<20230918192455.499898-1-amolith@secluded.site> (view parent)
DKIM signature
pass
Download raw message
>+CREATE TABLE tel_inventory (
>+       tel                TEXT       PRIMARY KEY,
>
>+CREATE INDEX ON tel_inventory (tel, locality, region, available_after);

So, this creates one index over all of those columns.  We're unlikely to be 
using these columns together in a single query.  tel is already indexed 
becaue it is primary key.  so maybe a (locality, avaialble_after) index and 
a second (region, available_after) index?
Reply to thread Export thread (mbox)