summaryrefslogtreecommitdiff
path: root/lib/migrations/20161009040430-support-delete-note.js
blob: 39e6f7fbd2b24d4cd55820714709d86cf8d0772e (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'" || error.message === 'column "deletedAt" of relation "Notes" already exists') {
        console.log('Migration has already run… ignoring.')
      } else {
        throw error
      }
    })
  },

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