From 859808d72df6b5f895b788c3e0516195d467a722 Mon Sep 17 00:00:00 2001 From: kerenfinkelstein Date: Thu, 21 Sep 2023 18:35:04 +0300 Subject: [PATCH] fix: add migration script to jobs --- .../migrations/13_jobs_experiment.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/database/sequlize-handler/migrations/13_jobs_experiment.js diff --git a/src/database/sequlize-handler/migrations/13_jobs_experiment.js b/src/database/sequlize-handler/migrations/13_jobs_experiment.js new file mode 100644 index 00000000..4d1498c5 --- /dev/null +++ b/src/database/sequlize-handler/migrations/13_jobs_experiment.js @@ -0,0 +1,15 @@ +const Sequelize = require('sequelize'); + +module.exports.up = async (query, DataTypes) => { + const jobsTable = await query.describeTable('jobs'); + + if (!jobsTable.experiments) { + await query.addColumn( + 'jobs', 'experiments', + Sequelize.DataTypes.JSON); // stringified array + } +}; + +module.exports.down = async (query, DataTypes) => { + await query.removeColumn('jobs', 'experiments'); +};