Generalize queue logic

This commit is contained in:
Dominic Ferrando
2026-07-11 20:24:25 -04:00
parent d40b9209d5
commit d17b3d8960
3 changed files with 189 additions and 174 deletions
@@ -17,16 +17,6 @@ export async function up(db: Kysely<any>): Promise<void> {
.addColumn("has_failed", "boolean", (cb) => cb.notNull().defaultTo(false))
.execute()
// INDEX: ONE_ACTIVE_PRODUCT_SYNC
await db.schema.createIndex("idx_one_active_product_sync")
.on("product_syncs")
.column("ended_at")
.unique()
.where(sql.ref("started_at"), "is not", null)
.where("ended_at", "is", null)
.nullsNotDistinct()
.execute();
// TABLE: STANDARDS_DATASETS
await db.schema.createTable("standards_datasets")
.$call(addDefaultColumns)
@@ -68,9 +58,6 @@ export async function down(db: Kysely<any>): Promise<void> {
// TABLE: PRODUCT_SYNCS
await db.schema.dropTable("product_syncs").ifExists().execute()
// INDEX: ONE_ACTIVE_PRODUCT_SYNC
await db.schema.dropIndex("idx_one_active_product_sync").ifExists().execute();
// TABLE: CALCULATORS
await db.schema.dropTable("calculators").ifExists().execute()