mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -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'
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING)
|
||||
queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
||||
return queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING).then(function () {
|
||||
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
|
||||
})
|
||||
},
|
||||
|
||||
down: function (queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Users', 'accessToken')
|
||||
queryInterface.removeColumn('Users', 'refreshToken')
|
||||
return queryInterface.removeColumn('Users', 'accessToken').then(function () {
|
||||
return queryInterface.removeColumn('Users', 'refreshToken')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Notes', 'savedAt', Sequelize.DATE)
|
||||
queryInterface.createTable('Revisions', {
|
||||
id: {
|
||||
type: Sequelize.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
noteId: Sequelize.UUID,
|
||||
patch: Sequelize.TEXT,
|
||||
lastContent: Sequelize.TEXT,
|
||||
content: Sequelize.TEXT,
|
||||
length: Sequelize.INTEGER,
|
||||
createdAt: Sequelize.DATE,
|
||||
updatedAt: Sequelize.DATE
|
||||
return queryInterface.addColumn('Notes', 'savedAt', Sequelize.DATE).then(function () {
|
||||
return queryInterface.createTable('Revisions', {
|
||||
id: {
|
||||
type: Sequelize.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
noteId: Sequelize.UUID,
|
||||
patch: Sequelize.TEXT,
|
||||
lastContent: Sequelize.TEXT,
|
||||
content: Sequelize.TEXT,
|
||||
length: Sequelize.INTEGER,
|
||||
createdAt: Sequelize.DATE,
|
||||
updatedAt: Sequelize.DATE
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
down: function (queryInterface, Sequelize) {
|
||||
queryInterface.dropTable('Revisions')
|
||||
queryInterface.removeColumn('Notes', 'savedAt')
|
||||
return queryInterface.dropTable('Revisions').then(function () {
|
||||
return queryInterface.removeColumn('Notes', 'savedAt')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Notes', 'authorship', Sequelize.TEXT)
|
||||
queryInterface.addColumn('Revisions', 'authorship', Sequelize.TEXT)
|
||||
queryInterface.createTable('Authors', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
color: Sequelize.STRING,
|
||||
noteId: Sequelize.UUID,
|
||||
userId: Sequelize.UUID,
|
||||
createdAt: Sequelize.DATE,
|
||||
updatedAt: Sequelize.DATE
|
||||
return queryInterface.addColumn('Notes', 'authorship', Sequelize.TEXT).then(function () {
|
||||
return queryInterface.addColumn('Revisions', 'authorship', Sequelize.TEXT)
|
||||
}).then(function () {
|
||||
return queryInterface.createTable('Authors', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
color: Sequelize.STRING,
|
||||
noteId: Sequelize.UUID,
|
||||
userId: Sequelize.UUID,
|
||||
createdAt: Sequelize.DATE,
|
||||
updatedAt: Sequelize.DATE
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
down: function (queryInterface, Sequelize) {
|
||||
queryInterface.dropTable('Authors')
|
||||
queryInterface.removeColumn('Revisions', 'authorship')
|
||||
queryInterface.removeColumn('Notes', 'authorship')
|
||||
return queryInterface.dropTable('Authors').then(function () {
|
||||
return queryInterface.removeColumn('Revisions', 'authorship')
|
||||
}).then(function () {
|
||||
return queryInterface.removeColumn('Notes', 'authorship')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE)
|
||||
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE)
|
||||
},
|
||||
|
||||
down: function (queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Notes', 'deletedAt')
|
||||
return queryInterface.removeColumn('Notes', 'deletedAt')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Users', 'email', Sequelize.TEXT)
|
||||
queryInterface.addColumn('Users', 'password', Sequelize.TEXT)
|
||||
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
|
||||
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT)
|
||||
})
|
||||
},
|
||||
|
||||
down: function (queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Users', 'email')
|
||||
queryInterface.removeColumn('Users', 'password')
|
||||
return queryInterface.removeColumn('Users', 'email').then(function () {
|
||||
return queryInterface.removeColumn('Users', 'password')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue