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 +}