summaryrefslogtreecommitdiff
path: root/lib/migrations/20161009040430-support-delete-note.js
blob: 4df7a81cbf2979294fbba3a472a7e3f727e3ea42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict'
module.exports = {
  up: function (queryInterface, Sequelize) {
    return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) {
      if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'") {
        console.log('Migration has already run… ignoring.')
      } else {
        throw error
      }
    })
  },

  down: function (queryInterface, Sequelize) {
    return queryInterface.removeColumn('Notes', 'deletedAt')
  }
}