This commit is contained in:
Josh Harvey 2016-05-07 02:07:50 +03:00
parent e7960c217c
commit 808a8ab4a4
4 changed files with 74 additions and 14 deletions

View file

@ -1,9 +1,15 @@
var db = require('./db')
function singleQuotify (item) { return '\'' + item + '\'' }
exports.up = function (next) {
var statuses = ['notSeen', 'published', 'authorized', 'confirmed', 'rejected']
.map(singleQuotify).join(',')
var sql = [
'create type status_stage AS enum (' + statuses + ')',
'alter table transactions add dispensed boolean NOT NULL DEFAULT false',
'alter table transactions add authorized boolean NOT NULL DEFAULT false'
'alter table transactions add status status_stage NOT NULL DEFAULT \'notSeen\''
]
db.multi(sql, next)
}