25 lines
773 B
JavaScript
25 lines
773 B
JavaScript
|
|
/**
|
||
|
|
* 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');
|
||
|
|
};
|