Skip to content

Commit

Permalink
fix: optimize inscription backfill indexes (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr authored Aug 28, 2023
1 parent b1d3f2b commit ab2f7bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions migrations/1693234572099_locations-remove-duplicate-index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.dropIndex('locations', ['inscription_id'], { ifExists: true });
}

export function down(pgm: MigrationBuilder): void {
pgm.createIndex('locations', ['inscription_id'], { ifNotExists: true });
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createIndex('locations', ['inscription_id'], { where: 'inscription_id IS NULL' });
}

0 comments on commit ab2f7bf

Please sign in to comment.