From 4758e919c59c2f342a5b5f3e4c1e02494f860040 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Fri, 15 Mar 2019 04:47:09 +0000 Subject: [server/log] add log lib --- server/migrations/20190304043012-create-log.js | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 server/migrations/20190304043012-create-log.js (limited to 'server/migrations') diff --git a/server/migrations/20190304043012-create-log.js b/server/migrations/20190304043012-create-log.js new file mode 100644 index 0000000..a7f9c25 --- /dev/null +++ b/server/migrations/20190304043012-create-log.js @@ -0,0 +1,58 @@ +'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.STRING(2048) + }, + groupId: { + type: Sequelize.INTEGER, + onDelete: 'SET NULL', + references: { + model: 'groups', + key: 'id' + } + }, + groupSnapshot: { + type: Sequelize.JSON + }, + clientId: { + type: Sequelize.INTEGER, + onDelete: 'SET NULL', + references: { + model: 'clients', + key: 'id' + } + }, + clientSnapshot: { + type: Sequelize.JSON + }, + userId: { + type: Sequelize.INTEGER, + onDelete: 'SET NULL', + references: { + model: 'users', + key: 'id' + } + }, + userSnapshot: { + type: Sequelize.JSON + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('log') + } +} -- cgit v1.2.3-55-g7522