feat: individual discounts migration
feat: loyalty panel routing chore: rename promo-codes module to loyalty
This commit is contained in:
parent
576979f14f
commit
07f15db851
14 changed files with 183 additions and 55 deletions
21
migrations/1626891847835-add-individual-discounts.js
Normal file
21
migrations/1626891847835-add-individual-discounts.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
var db = require('./db')
|
||||
|
||||
exports.up = function (next) {
|
||||
var sql = [
|
||||
`CREATE TYPE individual_discount_identification_type AS ENUM('phone', 'id_number')`,
|
||||
`CREATE TABLE individual_discounts (
|
||||
id UUID PRIMARY KEY,
|
||||
identification individual_discount_identification_type NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
discount SMALLINT NOT NULL,
|
||||
soft_deleted BOOLEAN DEFAULT false
|
||||
)`,
|
||||
`CREATE UNIQUE INDEX uq_individual_discount ON individual_discounts (value) WHERE NOT soft_deleted`
|
||||
]
|
||||
|
||||
db.multi(sql, next)
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue