summaryrefslogtreecommitdiff
path: root/lib/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'lib/migrations')
-rw-r--r--lib/migrations/20160515114000-user-add-tokens.js10
-rw-r--r--lib/migrations/20160607060246-support-revision.js32
-rw-r--r--lib/migrations/20160703062241-support-authorship.js36
-rw-r--r--lib/migrations/20161009040430-support-delete-note.js4
-rw-r--r--lib/migrations/20161201050312-support-email-signin.js10
5 files changed, 51 insertions, 41 deletions
diff --git a/lib/migrations/20160515114000-user-add-tokens.js b/lib/migrations/20160515114000-user-add-tokens.js
index 4f051887..4d5818be 100644
--- a/lib/migrations/20160515114000-user-add-tokens.js
+++ b/lib/migrations/20160515114000-user-add-tokens.js
@@ -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')
+ })
}
}
diff --git a/lib/migrations/20160607060246-support-revision.js b/lib/migrations/20160607060246-support-revision.js
index 114aec2e..bcab97e3 100644
--- a/lib/migrations/20160607060246-support-revision.js
+++ b/lib/migrations/20160607060246-support-revision.js
@@ -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')
+ })
}
}
diff --git a/lib/migrations/20160703062241-support-authorship.js b/lib/migrations/20160703062241-support-authorship.js
index a1d695e5..d73923b0 100644
--- a/lib/migrations/20160703062241-support-authorship.js
+++ b/lib/migrations/20160703062241-support-authorship.js
@@ -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')
+ })
}
}
diff --git a/lib/migrations/20161009040430-support-delete-note.js b/lib/migrations/20161009040430-support-delete-note.js
index 6e6fa20e..a39d1086 100644
--- a/lib/migrations/20161009040430-support-delete-note.js
+++ b/lib/migrations/20161009040430-support-delete-note.js
@@ -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')
}
}
diff --git a/lib/migrations/20161201050312-support-email-signin.js b/lib/migrations/20161201050312-support-email-signin.js
index 1f3abb1e..d33225f1 100644
--- a/lib/migrations/20161201050312-support-email-signin.js
+++ b/lib/migrations/20161201050312-support-email-signin.js
@@ -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')
+ })
}
}