1997fe48bb
Adds the doc-mandated IiosProjectionCursor (ordered high-water-mark + rolling checksum per projection/topic/partition) and a reusable ProjectionCursorService.advance(). The checksum is a deterministic fold over the ordered event stream, so replaying the same events reproduces it — the KG-06 proof that replay reproduces projection outcomes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
20 lines
683 B
SQL
20 lines
683 B
SQL
-- CreateTable
|
|
CREATE TABLE "IiosProjectionCursor" (
|
|
"id" TEXT NOT NULL,
|
|
"projectionName" TEXT NOT NULL,
|
|
"sourceTopic" TEXT NOT NULL,
|
|
"partitionKey" TEXT NOT NULL,
|
|
"lastEventId" TEXT NOT NULL,
|
|
"lastOffset" INTEGER NOT NULL DEFAULT 0,
|
|
"checksum" TEXT NOT NULL,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "IiosProjectionCursor_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "IiosProjectionCursor_partitionKey_idx" ON "IiosProjectionCursor"("partitionKey");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "IiosProjectionCursor_projectionName_sourceTopic_partitionKe_key" ON "IiosProjectionCursor"("projectionName", "sourceTopic", "partitionKey");
|