summaryrefslogtreecommitdiffstats
path: root/server/migrations
diff options
context:
space:
mode:
authorUdo Walter2018-09-17 20:25:13 +0200
committerUdo Walter2018-09-17 20:25:13 +0200
commit2f4ec682bfd88c651451d32f292e3f172daa4f11 (patch)
treedb4d2ebeaf7eac60f1162a06666deac04fc6eab9 /server/migrations
parentUpdate npm packages (diff)
downloadbas-2f4ec682bfd88c651451d32f292e3f172daa4f11.tar.gz
bas-2f4ec682bfd88c651451d32f292e3f172daa4f11.tar.xz
bas-2f4ec682bfd88c651451d32f292e3f172daa4f11.zip
add ipxe entry and config database migrations and models
Diffstat (limited to 'server/migrations')
-rw-r--r--server/migrations/20180917132233-create-config.js31
-rw-r--r--server/migrations/20180917132333-create-entry.js22
-rw-r--r--server/migrations/20180917202533-create-config_x_entry.js39
3 files changed, 92 insertions, 0 deletions
diff --git a/server/migrations/20180917132233-create-config.js b/server/migrations/20180917132233-create-config.js
new file mode 100644
index 0000000..fe46f62
--- /dev/null
+++ b/server/migrations/20180917132233-create-config.js
@@ -0,0 +1,31 @@
+'use strict'
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ return queryInterface.createTable('configs', {
+ id: {
+ allowNull: false,
+ autoIncrement: true,
+ primaryKey: true,
+ type: Sequelize.INTEGER
+ },
+ name: {
+ type: Sequelize.STRING
+ },
+ description: {
+ type: Sequelize.STRING(2048)
+ },
+ defaultEntry: {
+ type: Sequelize.INTEGER
+ },
+ timeout: {
+ type: Sequelize.INTEGER
+ },
+ script: {
+ type: Sequelize.STRING(4096)
+ }
+ })
+ },
+ down: (queryInterface, Sequelize) => {
+ return queryInterface.dropTable('configs')
+ }
+}
diff --git a/server/migrations/20180917132333-create-entry.js b/server/migrations/20180917132333-create-entry.js
new file mode 100644
index 0000000..20ed4c3
--- /dev/null
+++ b/server/migrations/20180917132333-create-entry.js
@@ -0,0 +1,22 @@
+'use strict'
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ return queryInterface.createTable('entries', {
+ id: {
+ allowNull: false,
+ autoIncrement: true,
+ primaryKey: true,
+ type: Sequelize.INTEGER
+ },
+ name: {
+ type: Sequelize.STRING
+ },
+ script: {
+ type: Sequelize.STRING(4096)
+ }
+ })
+ },
+ down: (queryInterface, Sequelize) => {
+ return queryInterface.dropTable('entries')
+ }
+}
diff --git a/server/migrations/20180917202533-create-config_x_entry.js b/server/migrations/20180917202533-create-config_x_entry.js
new file mode 100644
index 0000000..4e32ea9
--- /dev/null
+++ b/server/migrations/20180917202533-create-config_x_entry.js
@@ -0,0 +1,39 @@
+'use strict'
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ return queryInterface.createTable('config_x_entry', {
+ groupId: {
+ primaryKey: true,
+ allowNull: false,
+ type: Sequelize.INTEGER,
+ onDelete: 'cascade',
+ references: {
+ model: 'configs',
+ key: 'id'
+ }
+ },
+ clientId: {
+ primaryKey: true,
+ allowNull: false,
+ type: Sequelize.INTEGER,
+ onDelete: 'cascade',
+ references: {
+ model: 'entries',
+ key: 'id'
+ }
+ },
+ sortValue: {
+ type: Sequelize.INTEGER
+ },
+ customName: {
+ type: Sequelize.STRING
+ },
+ keyBind: {
+ type: Sequelize.STRING
+ }
+ })
+ },
+ down: (queryInterface, Sequelize) => {
+ return queryInterface.dropTable('config_x_entry')
+ }
+}