summaryrefslogblamecommitdiffstats
path: root/server/migrations/20190304043012-create-log.js
blob: 6ffff4cccfcf7962016356ed6e92e4a721fe2352 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                              
                            









                                
                            









                                
                            









                                
                            






                                          
'use strict'
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('log', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      timestamp: {
        type: Sequelize.BIGINT
      },
      category: {
        type: Sequelize.STRING
      },
      description: {
        type: Sequelize.TEXT
      },
      groupId: {
        type: Sequelize.INTEGER,
        onDelete: 'SET NULL',
        references: {
          model: 'groups',
          key: 'id'
        }
      },
      groupSnapshot: {
        type: Sequelize.TEXT
      },
      clientId: {
        type: Sequelize.INTEGER,
        onDelete: 'SET NULL',
        references: {
          model: 'clients',
          key: 'id'
        }
      },
      clientSnapshot: {
        type: Sequelize.TEXT
      },
      userId: {
        type: Sequelize.INTEGER,
        onDelete: 'SET NULL',
        references: {
          model: 'users',
          key: 'id'
        }
      },
      userSnapshot: {
        type: Sequelize.TEXT
      }
    })
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('log')
  }
}