summaryrefslogtreecommitdiff
path: root/lib/migrations/20150702001020-update-to-0_3_1.js
diff options
context:
space:
mode:
authorRaccoon2017-03-28 16:48:30 +0800
committerGitHub2017-03-28 16:48:30 +0800
commit0b4dac74ed8c0da66c340add45ce78a067c69ee9 (patch)
tree3fd13e29ae3520bdb6a2e5ec061aca1094047d7c /lib/migrations/20150702001020-update-to-0_3_1.js
parentb2985085d011cad374c76ae75f548fdefb15c258 (diff)
parente46874d04a4974ddb655962b6da8afb2928bc991 (diff)
Merge pull request #406 from hackmdio/feature/add_missing_migration
fix: Add missing migration
Diffstat (limited to 'lib/migrations/20150702001020-update-to-0_3_1.js')
-rw-r--r--lib/migrations/20150702001020-update-to-0_3_1.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/migrations/20150702001020-update-to-0_3_1.js b/lib/migrations/20150702001020-update-to-0_3_1.js
new file mode 100644
index 00000000..40d9c97a
--- /dev/null
+++ b/lib/migrations/20150702001020-update-to-0_3_1.js
@@ -0,0 +1,38 @@
+'use strict'
+module.exports = {
+ up: function (queryInterface, Sequelize) {
+ return queryInterface.addColumn('Notes', 'shortid', {
+ type: Sequelize.STRING,
+ defaultValue: '0000000000',
+ allowNull: false
+ }).then(function () {
+ return queryInterface.addIndex('Notes', ['shortid'], {
+ indicesType: 'UNIQUE'
+ })
+ }).then(function () {
+ return queryInterface.addColumn('Notes', 'permission', {
+ type: Sequelize.STRING,
+ defaultValue: 'private',
+ allowNull: false
+ })
+ }).then(function () {
+ return queryInterface.addColumn('Notes', 'viewcount', {
+ type: Sequelize.INTEGER,
+ defaultValue: 0
+ })
+ })
+ },
+
+ down: function (queryInterface, Sequelize) {
+ return queryInterface.removeColumn('Notes', 'viewcount')
+ .then(function () {
+ return queryInterface.removeColumn('Notes', 'permission')
+ })
+ .then(function () {
+ return queryInterface.removeIndex('Notes', ['shortid'])
+ })
+ .then(function () {
+ return queryInterface.removeColumn('Notes', 'shortid')
+ })
+ }
+}