Compare commits
1 Commits
visa-maste
...
migrations
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fbbcd5ffa |
@@ -2,6 +2,7 @@ DROP TABLE IF EXISTS payment_texts;
|
|||||||
DROP TABLE IF EXISTS rbac_version;
|
DROP TABLE IF EXISTS rbac_version;
|
||||||
DROP FUNCTION IF EXISTS rbac_bump_version() CASCADE;
|
DROP FUNCTION IF EXISTS rbac_bump_version() CASCADE;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS visa_master_order_actions;
|
||||||
DROP TABLE IF EXISTS visa_master_payment_logs;
|
DROP TABLE IF EXISTS visa_master_payment_logs;
|
||||||
DROP TABLE IF EXISTS visa_master_order_payments;
|
DROP TABLE IF EXISTS visa_master_order_payments;
|
||||||
DROP TABLE IF EXISTS payment_settings;
|
DROP TABLE IF EXISTS payment_settings;
|
||||||
|
|||||||
@@ -622,6 +622,12 @@ CREATE INDEX IF NOT EXISTS visa_master_order_payments_order_id_idx ON visa_maste
|
|||||||
CREATE INDEX IF NOT EXISTS visa_master_order_payments_user_id_idx ON visa_master_order_payments (user_id);
|
CREATE INDEX IF NOT EXISTS visa_master_order_payments_user_id_idx ON visa_master_order_payments (user_id);
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS visa_master_order_payments_order_number_idx
|
CREATE UNIQUE INDEX IF NOT EXISTS visa_master_order_payments_order_number_idx
|
||||||
ON visa_master_order_payments (order_number);
|
ON visa_master_order_payments (order_number);
|
||||||
|
-- payment-history lists newest-first (ORDER BY p.id DESC) and is commonly
|
||||||
|
-- filtered to one gateway_status; without this, a rare status (e.g.
|
||||||
|
-- pending) means walking the whole primary key backwards to fill a page.
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_visa_master_order_payments_status_id
|
||||||
|
ON visa_master_order_payments (gateway_status, id DESC)
|
||||||
|
WHERE deleted_at IS NULL;
|
||||||
|
|
||||||
-- Every individual step taken while processing a payout (validated, rate
|
-- Every individual step taken while processing a payout (validated, rate
|
||||||
-- fetched, gateway request sent, gateway response received, order marked
|
-- fetched, gateway request sent, gateway response received, order marked
|
||||||
@@ -643,6 +649,37 @@ CREATE TABLE IF NOT EXISTS visa_master_payment_logs (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS visa_master_payment_logs_order_id_idx ON visa_master_payment_logs (order_id);
|
CREATE INDEX IF NOT EXISTS visa_master_payment_logs_order_id_idx ON visa_master_payment_logs (order_id);
|
||||||
|
-- payment-history reads each attempt's register/callback log rows
|
||||||
|
-- (formUrl, returnUrl, first callback) by order and step; without this
|
||||||
|
-- every row of a page scans all of its order's logs.
|
||||||
|
CREATE INDEX IF NOT EXISTS visa_master_payment_logs_order_step_idx
|
||||||
|
ON visa_master_payment_logs (order_id, step);
|
||||||
|
|
||||||
|
-- Every create/update/delete of a visa/master or sber order, for the
|
||||||
|
-- order page's "Ammallar" table: who did it, whether it went through, and
|
||||||
|
-- for an update only the columns that changed - original holds their
|
||||||
|
-- values before, changes after. A create has no original and a delete no
|
||||||
|
-- changes. Failed actions are kept too, with exception set and changes
|
||||||
|
-- holding what was attempted. created_by is null when no user started it
|
||||||
|
-- (the GBÜS callback finalizing a payment).
|
||||||
|
CREATE TABLE IF NOT EXISTS visa_master_order_actions (
|
||||||
|
id bigserial PRIMARY KEY,
|
||||||
|
order_id bigint NOT NULL,
|
||||||
|
name character varying(20) NOT NULL,
|
||||||
|
status character varying(20) NOT NULL,
|
||||||
|
original jsonb,
|
||||||
|
changes jsonb,
|
||||||
|
exception text,
|
||||||
|
created_by bigint,
|
||||||
|
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||||
|
CONSTRAINT visa_master_order_actions_order_id_fkey
|
||||||
|
FOREIGN KEY (order_id) REFERENCES visa_master_payment_orders(id),
|
||||||
|
CONSTRAINT visa_master_order_actions_created_by_fkey
|
||||||
|
FOREIGN KEY (created_by) REFERENCES users(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS visa_master_order_actions_order_id_idx
|
||||||
|
ON visa_master_order_actions (order_id, id DESC);
|
||||||
|
|
||||||
-- Admin-editable texts shown to clients around a visa/master/sber payout
|
-- Admin-editable texts shown to clients around a visa/master/sber payout
|
||||||
-- (e.g. the warning before paying). Clients look a text up by its fixed
|
-- (e.g. the warning before paying). Clients look a text up by its fixed
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
DROP INDEX IF EXISTS idx_visa_master_order_payments_status_id;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
-- payment-history lists newest-first (ORDER BY p.id DESC) and is commonly
|
|
||||||
-- filtered to one gateway_status; without this, a rare status (e.g.
|
|
||||||
-- pending) means walking the whole primary key backwards to fill a page.
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_visa_master_order_payments_status_id
|
|
||||||
ON visa_master_order_payments (gateway_status, id DESC)
|
|
||||||
WHERE deleted_at IS NULL;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP INDEX IF EXISTS visa_master_payment_logs_order_step_idx;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
-- payment-history reads each attempt's register/callback log rows
|
|
||||||
-- (formUrl, returnUrl, first callback) by order and step; without this
|
|
||||||
-- every row of a page scans all of its order's logs.
|
|
||||||
CREATE INDEX IF NOT EXISTS visa_master_payment_logs_order_step_idx
|
|
||||||
ON visa_master_payment_logs (order_id, step);
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS visa_master_order_actions;
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
-- Every create/update/delete of a visa/master or sber order, for the
|
|
||||||
-- order page's "Ammallar" table: who did it, whether it went through, and
|
|
||||||
-- for an update only the columns that changed - original holds their
|
|
||||||
-- values before, changes after. A create has no original and a delete no
|
|
||||||
-- changes. Failed actions are kept too, with exception set and changes
|
|
||||||
-- holding what was attempted. created_by is null when no user started it
|
|
||||||
-- (the GBÜS callback finalizing a payment).
|
|
||||||
CREATE TABLE IF NOT EXISTS visa_master_order_actions (
|
|
||||||
id bigserial PRIMARY KEY,
|
|
||||||
order_id bigint NOT NULL,
|
|
||||||
name character varying(20) NOT NULL,
|
|
||||||
status character varying(20) NOT NULL,
|
|
||||||
original jsonb,
|
|
||||||
changes jsonb,
|
|
||||||
exception text,
|
|
||||||
created_by bigint,
|
|
||||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
|
||||||
CONSTRAINT visa_master_order_actions_order_id_fkey
|
|
||||||
FOREIGN KEY (order_id) REFERENCES visa_master_payment_orders(id),
|
|
||||||
CONSTRAINT visa_master_order_actions_created_by_fkey
|
|
||||||
FOREIGN KEY (created_by) REFERENCES users(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS visa_master_order_actions_order_id_idx
|
|
||||||
ON visa_master_order_actions (order_id, id DESC);
|
|
||||||
Reference in New Issue
Block a user