diff --git a/packages/database/lib/migrations/20240912210952_index_sync_config_id_sync.cjs b/packages/database/lib/migrations/20240912210952_index_sync_config_id_sync.cjs new file mode 100644 index 00000000000..5cc5eb16100 --- /dev/null +++ b/packages/database/lib/migrations/20240912210952_index_sync_config_id_sync.cjs @@ -0,0 +1,18 @@ +exports.config = { transaction: false }; + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function (knex, _) { + await knex.schema.raw( + `CREATE INDEX CONCURRENTLY IF NOT EXISTS "idx_sync_config_id_where_deleted" + ON "_nango_syncs" USING BTREE ("sync_config_id") + WHERE deleted = false` + ); +}; +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function (knex, _) { + await knex.schema.raw('DROP INDEX CONCURRENTLY IF EXISTS idx_sync_config_id_where_deleted'); +};