From b23ffae0e83a0d2f0b07a0a39d9fd377a8911d7d Mon Sep 17 00:00:00 2001 From: Alex Pickering Date: Thu, 19 Sep 2024 12:13:33 -0700 Subject: [PATCH] rename last params to seurat_object Signed-off-by: Alex Pickering --- ...0240918171424_rename_last_params_seurat.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/sql/migrations/20240918171424_rename_last_params_seurat.js diff --git a/src/sql/migrations/20240918171424_rename_last_params_seurat.js b/src/sql/migrations/20240918171424_rename_last_params_seurat.js new file mode 100644 index 000000000..fbfab6227 --- /dev/null +++ b/src/sql/migrations/20240918171424_rename_last_params_seurat.js @@ -0,0 +1,25 @@ +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = async (knex) => { + // Update the last_pipeline_params to set sampleTechnology to seurat_object where it is currently seurat + await knex('experiment_execution') + .where({ pipeline_type: 'obj2s' }) + .update({ + last_pipeline_params: knex.raw("jsonb_set(last_pipeline_params::jsonb, '{sampleTechnology}', '\"seurat_object\"'::jsonb)"), + }); +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = async (knex) => { + // Revert sampleTechnology back to seurat + await knex('experiment_execution') + .where({ pipeline_type: 'obj2s' }) + .update({ + last_pipeline_params: knex.raw("jsonb_set(last_pipeline_params::jsonb, '{sampleTechnology}', '\"seurat\"'::jsonb)"), + }); +};