Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

schema-events.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

schema-events.tsBlame32 lines · 1 contributor
b45db84Claude1/**
2 * Signal Bus P1 — Drizzle schema for the inbound-event idempotency table.
3 *
4 * Defined in a SEPARATE module because `src/db/schema.ts` is listed in
5 * §4 LOCKED BLOCKS of BUILD_BIBLE.md and must not be edited. New tables are
6 * allowed "only via new migration"; this module supplies the matching Drizzle
7 * definitions that migration `drizzle/0034_processed_events.sql` creates at
8 * the SQL layer. Import `processedEvents` directly from this module.
9 *
10 * Columns mirror the SQL migration 1:1. Keep them in sync whenever the
11 * migration is superseded by a follow-up additive migration.
12 */
13
14import { index, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
15
16export const processedEvents = pgTable(
17 "processed_events",
18 {
19 id: uuid("id").primaryKey().defaultRandom(),
20 eventId: text("event_id").notNull().unique(),
21 eventType: text("event_type").notNull(),
22 source: text("source").notNull(),
23 receivedAt: timestamp("received_at").defaultNow().notNull(),
24 // Raw payload retained for forensics / replay. jsonb column — callers
25 // pass a plain object and drizzle serialises it.
26 payload: jsonb("payload"),
27 },
28 (table) => [
29 index("processed_events_event_id_idx").on(table.eventId),
30 index("processed_events_source_type_idx").on(table.source, table.eventType),
31 ]
32);