From 039be437233b3443f8ab0b93d6f34929534ba670 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Thu, 19 Jul 2018 03:58:05 +0000 Subject: [server/groups][webapp/groups] added first version of the groups module --- server/migrations/20180717132233-create-group.js | 19 +++++++++++++++ server/migrations/20180717132333-create-client.js | 28 ++++++++++++++++++++++ .../20180717202333-create-group_x_group.js | 28 ++++++++++++++++++++++ .../20180717202533-create-group_x_client.js | 28 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 server/migrations/20180717132233-create-group.js create mode 100644 server/migrations/20180717132333-create-client.js create mode 100644 server/migrations/20180717202333-create-group_x_group.js create mode 100644 server/migrations/20180717202533-create-group_x_client.js (limited to 'server/migrations') diff --git a/server/migrations/20180717132233-create-group.js b/server/migrations/20180717132233-create-group.js new file mode 100644 index 0000000..720a1e7 --- /dev/null +++ b/server/migrations/20180717132233-create-group.js @@ -0,0 +1,19 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('groups', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + name: { + type: Sequelize.STRING + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('groups') + } +} diff --git a/server/migrations/20180717132333-create-client.js b/server/migrations/20180717132333-create-client.js new file mode 100644 index 0000000..79552c4 --- /dev/null +++ b/server/migrations/20180717132333-create-client.js @@ -0,0 +1,28 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('clients', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + name: { + type: Sequelize.STRING + }, + ip: { + type: Sequelize.STRING + }, + mac: { + type: Sequelize.STRING + }, + uuid: { + type: Sequelize.STRING + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('clients') + } +} diff --git a/server/migrations/20180717202333-create-group_x_group.js b/server/migrations/20180717202333-create-group_x_group.js new file mode 100644 index 0000000..4263f9a --- /dev/null +++ b/server/migrations/20180717202333-create-group_x_group.js @@ -0,0 +1,28 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('group_x_group', { + parentId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + references: { + model: 'groups', + key: 'id' + } + }, + childId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + references: { + model: 'groups', + key: 'id' + } + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('group_x_group') + } +} diff --git a/server/migrations/20180717202533-create-group_x_client.js b/server/migrations/20180717202533-create-group_x_client.js new file mode 100644 index 0000000..e3bd490 --- /dev/null +++ b/server/migrations/20180717202533-create-group_x_client.js @@ -0,0 +1,28 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('group_x_client', { + groupId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + references: { + model: 'groups', + key: 'id' + } + }, + clientId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + references: { + model: 'clients', + key: 'id' + } + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('group_x_client') + } +} -- cgit v1.2.3-55-g7522