From be99ab4f99a1dbd611e2ed8983481bb644dc1ff0 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Wed, 3 Jan 2018 20:13:43 +0000 Subject: [PATCH] don't fail on fresh install --- migrations/1509439657189-add_machine_name_to_devices.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migrations/1509439657189-add_machine_name_to_devices.js b/migrations/1509439657189-add_machine_name_to_devices.js index 27943eb9..38d77384 100644 --- a/migrations/1509439657189-add_machine_name_to_devices.js +++ b/migrations/1509439657189-add_machine_name_to_devices.js @@ -10,6 +10,14 @@ exports.up = function (next) { 'alter table devices alter column name set not null' ] + return db.multi(sql, next) + }) + .catch(() => { + const sql = [ + 'alter table devices add column name text', + 'alter table devices alter column name set not null' + ] + return db.multi(sql, next) }) }