feat(core): initial implementation of syncing (#17814)
This commit is contained in:
parent
0c0c6f3bdb
commit
b0017bf1b9
32 changed files with 5227 additions and 2584 deletions
16
packages/opencode/src/sync/event.sql.ts
Normal file
16
packages/opencode/src/sync/event.sql.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"
|
||||
|
||||
export const EventSequenceTable = sqliteTable("event_sequence", {
|
||||
aggregate_id: text().notNull().primaryKey(),
|
||||
seq: integer().notNull(),
|
||||
})
|
||||
|
||||
export const EventTable = sqliteTable("event", {
|
||||
id: text().primaryKey(),
|
||||
aggregate_id: text()
|
||||
.notNull()
|
||||
.references(() => EventSequenceTable.aggregate_id, { onDelete: "cascade" }),
|
||||
seq: integer().notNull(),
|
||||
type: text().notNull(),
|
||||
data: text({ mode: "json" }).$type<Record<string, unknown>>().notNull(),
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue