|
| 1 | +/* eslint-disable @typescript-eslint/naming-convention */ |
| 2 | +import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate'; |
| 3 | + |
| 4 | +export const shorthands: ColumnDefinitions | undefined = undefined; |
| 5 | + |
| 6 | +export function up(pgm: MigrationBuilder): void { |
| 7 | + pgm.createIndex('jobs', ['token_id']); |
| 8 | + pgm.createIndex('jobs', ['smart_contract_id']); |
| 9 | + pgm.createIndex('jobs', ['status'], { name: 'jobs_status_all_index' }); |
| 10 | + pgm.createIndex('jobs', ['status', { name: 'updated_at', sort: 'ASC' }], { |
| 11 | + where: "status = 'queued'", |
| 12 | + }); |
| 13 | + |
| 14 | + pgm.createIndex('tokens', ['type', 'name'], { where: "type = 'ft'" }); |
| 15 | + pgm.createIndex('tokens', ['type', 'symbol'], { where: "type = 'ft'" }); |
| 16 | + pgm.createIndex('tokens', ['type']); |
| 17 | + |
| 18 | + pgm.createIndex( |
| 19 | + 'update_notifications', |
| 20 | + [ |
| 21 | + 'update_mode', |
| 22 | + 'token_id', |
| 23 | + { name: 'block_height', sort: 'DESC' }, |
| 24 | + { name: 'tx_index', sort: 'DESC' }, |
| 25 | + { name: 'event_index', sort: 'DESC' }, |
| 26 | + ], |
| 27 | + { where: "update_mode = 'dynamic'" } |
| 28 | + ); |
| 29 | +} |
0 commit comments