From 353761b07015a26841549cc259ae0687bc8e4865 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Wed, 10 Oct 2018 15:00:56 +0000 Subject: [registration] Add dbs and code for the registration scripts Add Table for the registration hooks. Add Table for the hooks - groups association. Add nexthook for the minilinux to pull the next bash script. Add state for setting the new script after completing the current one. --- .../20181008151633-create-registrationhook.js | 21 +++++++++++++++ ...181009154133-create-registrationhook_x_group.js | 30 ++++++++++++++++++++++ .../20181009162133-add-registrationState-client.js | 16 ++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 server/migrations/20181008151633-create-registrationhook.js create mode 100644 server/migrations/20181009154133-create-registrationhook_x_group.js create mode 100644 server/migrations/20181009162133-add-registrationState-client.js (limited to 'server/migrations') diff --git a/server/migrations/20181008151633-create-registrationhook.js b/server/migrations/20181008151633-create-registrationhook.js new file mode 100644 index 0000000..59692c5 --- /dev/null +++ b/server/migrations/20181008151633-create-registrationhook.js @@ -0,0 +1,21 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('registrationhooks', { + id: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + }, + sortvalue: Sequelize.INTEGER, + type: Sequelize.STRING, + script: { + allowNull: true, + type: Sequelize.BLOB + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('registrationhook') + } +} diff --git a/server/migrations/20181009154133-create-registrationhook_x_group.js b/server/migrations/20181009154133-create-registrationhook_x_group.js new file mode 100644 index 0000000..5d52a5b --- /dev/null +++ b/server/migrations/20181009154133-create-registrationhook_x_group.js @@ -0,0 +1,30 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('registrationhook_x_group', { + registrationhookId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + onDelete: 'cascade', + references: { + model: 'registrationhooks', + key: 'id' + } + }, + groupId: { + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER, + onDelete: 'cascade', + references: { + model: 'groups', + key: 'id' + } + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.dropTable('registrationhook_x_group') + } +} diff --git a/server/migrations/20181009162133-add-registrationState-client.js b/server/migrations/20181009162133-add-registrationState-client.js new file mode 100644 index 0000000..59e90cd --- /dev/null +++ b/server/migrations/20181009162133-add-registrationState-client.js @@ -0,0 +1,16 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.addColumn('clients', 'registrationState', { + type: Sequelize.INTEGER, + onDelete: 'SET NULL', + references: { + model: 'registrationhooks', + key: 'id' + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.removeColumn('clients', 'registrationState') + } +} \ No newline at end of file -- cgit v1.2.3-55-g7522