mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 11:54:27 -05:00
fix: Fixed sequelize-cli db:migration cannot stop when occur error
Up and Down method must return a Promise. breaking changes: docker-hackmd cannot initialize, because db:migration will fail
This commit is contained in:
parent
cdd8a72d04
commit
66fc817ad4
5 changed files with 51 additions and 41 deletions
|
@ -1,12 +1,14 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING)
|
return queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING).then(function () {
|
||||||
queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
down: function (queryInterface, Sequelize) {
|
down: function (queryInterface, Sequelize) {
|
||||||
queryInterface.removeColumn('Users', 'accessToken')
|
return queryInterface.removeColumn('Users', 'accessToken').then(function () {
|
||||||
queryInterface.removeColumn('Users', 'refreshToken')
|
return queryInterface.removeColumn('Users', 'refreshToken')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
queryInterface.addColumn('Notes', 'savedAt', Sequelize.DATE)
|
return queryInterface.addColumn('Notes', 'savedAt', Sequelize.DATE).then(function () {
|
||||||
queryInterface.createTable('Revisions', {
|
return queryInterface.createTable('Revisions', {
|
||||||
id: {
|
id: {
|
||||||
type: Sequelize.UUID,
|
type: Sequelize.UUID,
|
||||||
primaryKey: true
|
primaryKey: true
|
||||||
|
@ -15,10 +15,12 @@ module.exports = {
|
||||||
createdAt: Sequelize.DATE,
|
createdAt: Sequelize.DATE,
|
||||||
updatedAt: Sequelize.DATE
|
updatedAt: Sequelize.DATE
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
down: function (queryInterface, Sequelize) {
|
down: function (queryInterface, Sequelize) {
|
||||||
queryInterface.dropTable('Revisions')
|
return queryInterface.dropTable('Revisions').then(function () {
|
||||||
queryInterface.removeColumn('Notes', 'savedAt')
|
return queryInterface.removeColumn('Notes', 'savedAt')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
queryInterface.addColumn('Notes', 'authorship', Sequelize.TEXT)
|
return queryInterface.addColumn('Notes', 'authorship', Sequelize.TEXT).then(function () {
|
||||||
queryInterface.addColumn('Revisions', 'authorship', Sequelize.TEXT)
|
return queryInterface.addColumn('Revisions', 'authorship', Sequelize.TEXT)
|
||||||
queryInterface.createTable('Authors', {
|
}).then(function () {
|
||||||
|
return queryInterface.createTable('Authors', {
|
||||||
id: {
|
id: {
|
||||||
type: Sequelize.INTEGER,
|
type: Sequelize.INTEGER,
|
||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
|
@ -15,11 +16,14 @@ module.exports = {
|
||||||
createdAt: Sequelize.DATE,
|
createdAt: Sequelize.DATE,
|
||||||
updatedAt: Sequelize.DATE
|
updatedAt: Sequelize.DATE
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
down: function (queryInterface, Sequelize) {
|
down: function (queryInterface, Sequelize) {
|
||||||
queryInterface.dropTable('Authors')
|
return queryInterface.dropTable('Authors').then(function () {
|
||||||
queryInterface.removeColumn('Revisions', 'authorship')
|
return queryInterface.removeColumn('Revisions', 'authorship')
|
||||||
queryInterface.removeColumn('Notes', 'authorship')
|
}).then(function () {
|
||||||
|
return queryInterface.removeColumn('Notes', 'authorship')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE)
|
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE)
|
||||||
},
|
},
|
||||||
|
|
||||||
down: function (queryInterface, Sequelize) {
|
down: function (queryInterface, Sequelize) {
|
||||||
queryInterface.removeColumn('Notes', 'deletedAt')
|
return queryInterface.removeColumn('Notes', 'deletedAt')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
up: function (queryInterface, Sequelize) {
|
up: function (queryInterface, Sequelize) {
|
||||||
queryInterface.addColumn('Users', 'email', Sequelize.TEXT)
|
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
|
||||||
queryInterface.addColumn('Users', 'password', Sequelize.TEXT)
|
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
down: function (queryInterface, Sequelize) {
|
down: function (queryInterface, Sequelize) {
|
||||||
queryInterface.removeColumn('Users', 'email')
|
return queryInterface.removeColumn('Users', 'email').then(function () {
|
||||||
queryInterface.removeColumn('Users', 'password')
|
return queryInterface.removeColumn('Users', 'password')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue