From eadb472af90089fac08ed196dc66d92bcac3484a Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Tue, 26 Mar 2024 20:56:50 +0100 Subject: [PATCH] feat: Migrate app config id to app key --- ...26195028_migrate_app_config_id_to_app_key.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/backend/src/db/migrations/20240326195028_migrate_app_config_id_to_app_key.js diff --git a/packages/backend/src/db/migrations/20240326195028_migrate_app_config_id_to_app_key.js b/packages/backend/src/db/migrations/20240326195028_migrate_app_config_id_to_app_key.js new file mode 100644 index 00000000..05842ad7 --- /dev/null +++ b/packages/backend/src/db/migrations/20240326195028_migrate_app_config_id_to_app_key.js @@ -0,0 +1,17 @@ +export async function up(knex) { + const appAuthClients = await knex('app_auth_clients').select('*'); + + for (const appAuthClient of appAuthClients) { + const appConfig = await knex('app_configs') + .where('id', appAuthClient.app_config_id) + .first(); + + await knex('app_auth_clients') + .where('id', appAuthClient.id) + .update({ app_key: appConfig.key }); + } +} + +export async function down() { + // void +}