fix: optimize and normalize bills and blacklist
This commit is contained in:
parent
152fe786b9
commit
901b078d7f
2 changed files with 21 additions and 0 deletions
10
migrations/1744294267662-bills-performance.js
Normal file
10
migrations/1744294267662-bills-performance.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const db = require('./db')
|
||||
|
||||
exports.up = next => db.multi([
|
||||
'ALTER TABLE bills ADD CONSTRAINT cash_in_txs_id FOREIGN KEY (cash_in_txs_id) REFERENCES cash_in_txs(id);',
|
||||
'CREATE INDEX bills_cash_in_txs_id_idx ON bills USING btree (cash_in_txs_id);',
|
||||
`CREATE INDEX bills_null_cashbox_batch_id_idx ON bills (cash_in_txs_id) WHERE cashbox_batch_id IS NULL AND destination_unit = 'cashbox';`,
|
||||
'CREATE INDEX cash_in_txs_device_id_idx ON cash_in_txs USING btree (device_id);'
|
||||
], next)
|
||||
|
||||
exports.down = next => next()
|
||||
11
migrations/1744294267663-blacklist-normalization.js
Normal file
11
migrations/1744294267663-blacklist-normalization.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
const db = require('./db')
|
||||
|
||||
exports.up = next => db.multi([
|
||||
'ALTER TABLE public.blacklist DROP CONSTRAINT IF EXISTS blacklist_pkey;',
|
||||
'ALTER TABLE public.blacklist ADD PRIMARY KEY (address);',
|
||||
'DROP INDEX IF EXISTS blacklist_temp_address_key;',
|
||||
'CREATE UNIQUE INDEX blacklist_address_idx ON public.blacklist USING btree (address);',
|
||||
|
||||
], next)
|
||||
|
||||
exports.down = next => next()
|
||||
Loading…
Add table
Add a link
Reference in a new issue