deckhearth/migrations/1781442329511_add-catalog-sync-log.js

25 lines
773 B
JavaScript
Raw Normal View History

/**
* Track per-game catalog sync runs (staleness, upsert counts, errors).
*/
export const shorthands = undefined;
export const up = (pgm) => {
pgm.createTable('catalog_sync_log', {
id: 'id',
game: { type: 'varchar(20)', notNull: true },
mode: { type: 'varchar(20)', notNull: true },
upserted: { type: 'integer', notNull: true, default: 0 },
errors: { type: 'integer', notNull: true, default: 0 },
source_updated_at: { type: 'timestamptz' },
ran_at: { type: 'timestamptz', notNull: true, default: pgm.func('CURRENT_TIMESTAMP') },
details: { type: 'jsonb' },
});
pgm.createIndex('catalog_sync_log', 'game');
pgm.createIndex('catalog_sync_log', 'ran_at');
};
export const down = (pgm) => {
pgm.dropTable('catalog_sync_log');
};