summaryrefslogtreecommitdiffstats
path: root/server/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'server/migrations')
-rw-r--r--server/migrations/20180717132233-create-group.js19
-rw-r--r--server/migrations/20180717132333-create-client.js28
-rw-r--r--server/migrations/20180717202333-create-group_x_group.js28
-rw-r--r--server/migrations/20180717202533-create-group_x_client.js28
4 files changed, 103 insertions, 0 deletions
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')
+ }
+}