feat: use customer Autocomplete on discount creation
This commit is contained in:
parent
43ff04b2af
commit
847b87ecb0
8 changed files with 94 additions and 189 deletions
|
|
@ -2,15 +2,13 @@ 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,
|
||||
customer_id UUID NOT NULL REFERENCES customers(id),
|
||||
discount SMALLINT NOT NULL,
|
||||
soft_deleted BOOLEAN DEFAULT false
|
||||
)`,
|
||||
`CREATE UNIQUE INDEX uq_individual_discount ON individual_discounts (identification, value) WHERE NOT soft_deleted`
|
||||
`CREATE UNIQUE INDEX uq_individual_discount ON individual_discounts (customer_id) WHERE NOT soft_deleted`
|
||||
]
|
||||
|
||||
db.multi(sql, next)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue