diff options
Diffstat (limited to 'lib')
8 files changed, 56 insertions, 2 deletions
diff --git a/lib/migrations/20150702001020-update-to-0_3_1.js b/lib/migrations/20150702001020-update-to-0_3_1.js index 40d9c97a..e661a343 100644 --- a/lib/migrations/20150702001020-update-to-0_3_1.js +++ b/lib/migrations/20150702001020-update-to-0_3_1.js @@ -20,6 +20,12 @@ module.exports = { type: Sequelize.INTEGER, defaultValue: 0 }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'shortid'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20160112220142-note-add-lastchange.js b/lib/migrations/20160112220142-note-add-lastchange.js index b4e111b3..d0030d6b 100644 --- a/lib/migrations/20160112220142-note-add-lastchange.js +++ b/lib/migrations/20160112220142-note-add-lastchange.js @@ -7,6 +7,12 @@ module.exports = { return queryInterface.addColumn('Notes', 'lastchangeAt', { type: Sequelize.DATE }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'lastchangeuserId'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20160420180355-note-add-alias.js b/lib/migrations/20160420180355-note-add-alias.js index a043cd5c..4bad29ca 100644 --- a/lib/migrations/20160420180355-note-add-alias.js +++ b/lib/migrations/20160420180355-note-add-alias.js @@ -7,6 +7,12 @@ module.exports = { return queryInterface.addIndex('Notes', ['alias'], { indicesType: 'UNIQUE' }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'alias'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20160515114000-user-add-tokens.js b/lib/migrations/20160515114000-user-add-tokens.js index 4d5818be..4245f1ad 100644 --- a/lib/migrations/20160515114000-user-add-tokens.js +++ b/lib/migrations/20160515114000-user-add-tokens.js @@ -3,6 +3,12 @@ module.exports = { up: function (queryInterface, Sequelize) { return queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING).then(function () { return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'accessToken'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20160607060246-support-revision.js b/lib/migrations/20160607060246-support-revision.js index bcab97e3..10f288b0 100644 --- a/lib/migrations/20160607060246-support-revision.js +++ b/lib/migrations/20160607060246-support-revision.js @@ -15,6 +15,12 @@ module.exports = { createdAt: Sequelize.DATE, updatedAt: Sequelize.DATE }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'savedAt'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20160703062241-support-authorship.js b/lib/migrations/20160703062241-support-authorship.js index d73923b0..b3ced8c4 100644 --- a/lib/migrations/20160703062241-support-authorship.js +++ b/lib/migrations/20160703062241-support-authorship.js @@ -16,6 +16,12 @@ module.exports = { createdAt: Sequelize.DATE, updatedAt: Sequelize.DATE }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'authorship'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, diff --git a/lib/migrations/20161009040430-support-delete-note.js b/lib/migrations/20161009040430-support-delete-note.js index a39d1086..4df7a81c 100644 --- a/lib/migrations/20161009040430-support-delete-note.js +++ b/lib/migrations/20161009040430-support-delete-note.js @@ -1,7 +1,13 @@ 'use strict' module.exports = { up: function (queryInterface, Sequelize) { - return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE) + return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } + }) }, down: function (queryInterface, Sequelize) { diff --git a/lib/migrations/20161201050312-support-email-signin.js b/lib/migrations/20161201050312-support-email-signin.js index d33225f1..4653e67a 100644 --- a/lib/migrations/20161201050312-support-email-signin.js +++ b/lib/migrations/20161201050312-support-email-signin.js @@ -2,7 +2,19 @@ module.exports = { up: function (queryInterface, Sequelize) { return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () { - return queryInterface.addColumn('Users', 'password', Sequelize.TEXT) + return queryInterface.addColumn('Users', 'password', Sequelize.TEXT).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'password'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } + }) + }).catch(function (error) { + if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'email'") { + console.log('Migration has already run… ignoring.') + } else { + throw error + } }) }, |