@foundrynorth/compass-schema 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundrynorth/compass-schema",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Canonical Drizzle ORM schema for Foundry Compass (rough-waterfall database)",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/src/schema.ts CHANGED
@@ -7258,6 +7258,11 @@ export const contracts = pgTable(
7258
7258
  sentForSigningAt: timestamp("sent_for_signing_at"),
7259
7259
  sentForSigningBy: varchar("sent_for_signing_by"),
7260
7260
 
7261
+ // Flux sync cache fields (populated by fn-flux contract events)
7262
+ fluxAgreementId: text("flux_agreement_id"), // canonical reference to fn-flux agreement
7263
+ lastSyncedAt: timestamp("last_synced_at"), // when last event was received from fn-flux
7264
+ syncSource: varchar("sync_source").default("legacy"), // 'legacy' | 'flux'
7265
+
7261
7266
  // Audit
7262
7267
  notes: text("notes"),
7263
7268
  createdByUserId: varchar("created_by_user_id"),
@@ -7270,6 +7275,7 @@ export const contracts = pgTable(
7270
7275
  index("contracts_partner_id_idx").on(table.partnerId),
7271
7276
  index("contracts_status_idx").on(table.status),
7272
7277
  index("contracts_date_range_idx").on(table.startDate, table.endDate),
7278
+ index("contracts_flux_agreement_id_idx").on(table.fluxAgreementId),
7273
7279
  ]
7274
7280
  );
7275
7281
 
@@ -7284,6 +7290,9 @@ export const insertContractSchema = createInsertSchema(contracts).omit({
7284
7290
  actualMarginDollars: true,
7285
7291
  orderCount: true,
7286
7292
  lastRecalculatedAt: true,
7293
+ fluxAgreementId: true,
7294
+ lastSyncedAt: true,
7295
+ syncSource: true,
7287
7296
  });
7288
7297
  export const updateContractSchema = insertContractSchema.partial();
7289
7298
  export type Contract = typeof contracts.$inferSelect;