connector_state table
2 changed files +19 −0
added
packages/db/migrations/0002_connector_state.sql
+7 −0
@@ -0,0 +1,7 @@ | ||
| 1 | +CREATE TABLE IF NOT EXISTS "connector_state" ( | |
| 2 | + "connector_id" text NOT NULL, | |
| 3 | + "key" text NOT NULL, | |
| 4 | + "value" jsonb, | |
| 5 | + "updated_at" timestamp with time zone DEFAULT now() NOT NULL, | |
| 6 | + CONSTRAINT "connector_state_connector_id_key_pk" PRIMARY KEY("connector_id","key") | |
| 7 | +); | |
modified
packages/db/src/schema.ts
+12 −0
@@ -573,3 +573,15 @@ export const systemAlerts = pgTable("system_alerts", { | ||
| 573 | 573 | resolvedAt: ts("resolved_at"), |
| 574 | 574 | createdAt: createdAt(), |
| 575 | 575 | }); |
| 576 | + | |
| 577 | +/** Small key/value state per connector (cursors, seen keys, discovery snapshots). */ | |
| 578 | +export const connectorState = pgTable( | |
| 579 | + "connector_state", | |
| 580 | + { | |
| 581 | + connectorId: text("connector_id").notNull(), | |
| 582 | + key: text("key").notNull(), | |
| 583 | + value: jsonb("value"), | |
| 584 | + updatedAt: updatedAt(), | |
| 585 | + }, | |
| 586 | + (t) => [primaryKey({ columns: [t.connectorId, t.key] })], | |
| 587 | +); | |
| 576 | 588 | |