feat: add migration to clean blacklist table
fix: address reuse and blacklist check
This commit is contained in:
parent
f682a77eb5
commit
d7519d477e
4 changed files with 23 additions and 20 deletions
|
|
@ -2,8 +2,11 @@ var db = require('./db')
|
|||
|
||||
exports.up = function (next) {
|
||||
var sql = [
|
||||
`INSERT INTO blacklist SELECT DISTINCT crypto_code, to_address, false FROM cash_in_txs ON CONFLICT DO NOTHING`,
|
||||
`INSERT INTO blacklist SELECT DISTINCT crypto_code, to_address, false FROM cash_out_txs ON CONFLICT DO NOTHING`
|
||||
`ALTER TABLE blacklist DROP CONSTRAINT blacklist_crypto_code_address_created_by_operator_key`,
|
||||
`ALTER TABLE blacklist ADD CONSTRAINT blacklist_crypto_code_address_key UNIQUE (crypto_code, address)`,
|
||||
`DROP INDEX blacklist_created_by_operator_idx`,
|
||||
`ALTER TABLE blacklist DROP COLUMN created_by_operator`,
|
||||
`CREATE INDEX cash_in_txs_to_address_idx ON cash_in_txs(to_address)`
|
||||
]
|
||||
|
||||
db.multi(sql, next)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue