diff --git a/registry/server/migrations/20240315141721_pg_versioning_idx.ts b/registry/server/migrations/20240315141721_pg_versioning_idx.ts new file mode 100644 index 00000000..5bf93607 --- /dev/null +++ b/registry/server/migrations/20240315141721_pg_versioning_idx.ts @@ -0,0 +1,14 @@ +import { Knex } from 'knex'; +import { isPostgres } from '../util/db'; + +export async function up(knex: Knex): Promise { + if (isPostgres(knex)) { + return knex.raw('CREATE INDEX versioning_entity_idx ON public."versioning" (entity_type,entity_id,id DESC);'); + } +} + +export async function down(knex: Knex): Promise { + if (isPostgres(knex)) { + return knex.raw('DROP INDEX versioning_entity_idx;'); + } +}