summaryrefslogtreecommitdiff
path: root/lib/migrations/20150702001020-update-to-0_3_1.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/migrations/20150702001020-update-to-0_3_1.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/migrations/20150702001020-update-to-0_3_1.js b/lib/migrations/20150702001020-update-to-0_3_1.js
index a3163d74..40d9c97a 100644
--- a/lib/migrations/20150702001020-update-to-0_3_1.js
+++ b/lib/migrations/20150702001020-update-to-0_3_1.js
@@ -3,17 +3,22 @@ module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('Notes', 'shortid', {
type: Sequelize.STRING,
- unique: true,
+ defaultValue: '0000000000',
allowNull: false
}).then(function () {
+ return queryInterface.addIndex('Notes', ['shortid'], {
+ indicesType: 'UNIQUE'
+ })
+ }).then(function () {
return queryInterface.addColumn('Notes', 'permission', {
type: Sequelize.STRING,
- allowNull: false,
- defaultValue: 0
+ defaultValue: 'private',
+ allowNull: false
})
}).then(function () {
return queryInterface.addColumn('Notes', 'viewcount', {
- type: Sequelize.INTEGER
+ type: Sequelize.INTEGER,
+ defaultValue: 0
})
})
},
@@ -24,6 +29,9 @@ module.exports = {
return queryInterface.removeColumn('Notes', 'permission')
})
.then(function () {
+ return queryInterface.removeIndex('Notes', ['shortid'])
+ })
+ .then(function () {
return queryInterface.removeColumn('Notes', 'shortid')
})
}