Save migrations file on db (#215)

* Revert "Migration sql changes (#199)"

This reverts commit 12c834469c.

* Save migrate file on db

* Add message on migration error in lamassu-update
This commit is contained in:
Rafael Taranto 2018-11-18 07:15:22 -02:00 committed by Josh Harvey
parent 9af204e609
commit 06f8c57608
58 changed files with 1516 additions and 567 deletions

View file

@ -5,17 +5,17 @@ exports.up = function (next) {
return migrateTools.migrateNames()
.then(updateSql => {
const sql = [
db.addColumn('devices', 'name', 'text'),
'alter table devices add column name text',
updateSql,
db.alterColumn('devices', 'name', 'set not null')
'alter table devices alter column name set not null'
]
return db.multi(sql, next)
})
.catch(() => {
const sql = [
db.addColumn('devices', 'name', 'text'),
db.alterColumn('devices', 'name', 'set not null')
'alter table devices add column name text',
'alter table devices alter column name set not null'
]
return db.multi(sql, next)
@ -23,8 +23,6 @@ exports.up = function (next) {
}
exports.down = function (next) {
const sql = [
db.dropColumn('devices', 'name')
]
const sql = ['alter table devices drop column name']
db.multi(sql, next)
}