mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Extend migration error handling
The current error handling seems to conflict with some sequelize versions. So we add a second version of it in our excemptions. I'm not happy about it, but when it helps to prevent further migration breaking, it's worth it. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
007f252273
commit
81e3d7bd00
8 changed files with 9 additions and 9 deletions
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'shortid'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'shortid'" || error.message === 'column "shortid" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
||||||
type: Sequelize.DATE
|
type: Sequelize.DATE
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'lastchangeuserId'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'lastchangeuserId'" || error.message === 'column "lastchangeuserId" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
||||||
indicesType: 'UNIQUE'
|
indicesType: 'UNIQUE'
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'alias'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'alias'" || error.message === 'column "alias" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
return queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING).then(function () {
|
return queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING).then(function () {
|
||||||
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'accessToken'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'accessToken'" || error.message === 'column "accessToken" of relation "Users" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
updatedAt: Sequelize.DATE
|
updatedAt: Sequelize.DATE
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'savedAt'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'savedAt'" || error.message === 'column "savedAt" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = {
|
||||||
updatedAt: Sequelize.DATE
|
updatedAt: Sequelize.DATE
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'authorship'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'authorship'" || error.message === 'column "authorship" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) {
|
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'" || error.message === 'column "deletedAt" of relation "Notes" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
|
@ -3,14 +3,14 @@ module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
|
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
|
||||||
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT).catch(function (error) {
|
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'password'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'password'" || error.message === 'column "password" of relation "Users" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'email'") {
|
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'email'" || error.message === 'column "email" of relation "Users" already exists') {
|
||||||
console.log('Migration has already run… ignoring.')
|
console.log('Migration has already run… ignoring.')
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
|
|
Loading…
Reference in a new issue