summaryrefslogtreecommitdiffstats
path: root/server/migrations
diff options
context:
space:
mode:
authorUdo Walter2019-03-15 05:47:09 +0100
committerUdo Walter2019-03-15 05:47:09 +0100
commit4758e919c59c2f342a5b5f3e4c1e02494f860040 (patch)
treede8cae4339faee0b777b40ed3d7de1bf619e25d0 /server/migrations
parent[server] New clients are automaticly added to the groups of the fitting subra... (diff)
downloadbas-4758e919c59c2f342a5b5f3e4c1e02494f860040.tar.gz
bas-4758e919c59c2f342a5b5f3e4c1e02494f860040.tar.xz
bas-4758e919c59c2f342a5b5f3e4c1e02494f860040.zip
[server/log] add log lib
Diffstat (limited to 'server/migrations')
-rw-r--r--server/migrations/20190304043012-create-log.js58
1 files changed, 58 insertions, 0 deletions
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')
+ }
+}