summaryrefslogtreecommitdiff
path: root/lib/migrations/20150915153700-change-notes-title-to-text.js
blob: 9d00f15fde0f06142243db320ea1b7930ad7c0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict'
const isSQLite = require('../utils').isSQLite
module.exports = {
  up: function (queryInterface, Sequelize) {
    return queryInterface.changeColumn('Notes', 'title', {
      type: Sequelize.TEXT
    }).then(function () {
      if (isSQLite(queryInterface.sequelize)) {
        // manual added index will be removed in sqlite
        return queryInterface.addIndex('Notes', ['shortid'])
      }
    })
  },

  down: function (queryInterface, Sequelize) {
    return queryInterface.changeColumn('Notes', 'title', {
      type: Sequelize.STRING
    }).then(function () {
      if (isSQLite(queryInterface.sequelize)) {
        // manual added index will be removed in sqlite
        return queryInterface.addIndex('Notes', ['shortid'])
      }
    })
  }
}