@reventlessdev/reventless-postgres 3.0.0-alpha.3 → 3.0.0-alpha.5
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/CHANGELOG.md +16 -0
- package/lib/bs/.compiler.log +2 -2
- package/lib/bs/ReventlessPostgres.cmi +0 -0
- package/lib/bs/ReventlessPostgres.cmt +0 -0
- package/lib/bs/ReventlessPostgres.mlmap +2 -0
- package/lib/bs/compiler-info.json +1 -1
- package/lib/bs/src/DcbEventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/EventLogChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/EventLogChangeFeed-ReventlessPostgres.cmj +0 -0
- package/lib/bs/src/EventLogChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/EventLogChangeFeed.ast +0 -0
- package/lib/bs/src/EventLogChangeFeed.res +184 -0
- package/lib/bs/src/EventLogChangeFeed.res.mjs +134 -0
- package/lib/bs/src/EventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/EventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/PgChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgSchema-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/PgSchema-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgSchema.ast +0 -0
- package/lib/bs/src/PgSchema.res +36 -2
- package/lib/bs/src/PgSchema.res.mjs +9 -2
- package/lib/bs/src/QueryDbStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres-ReventlessPostgres.cmj +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres.ast +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres.res +35 -14
- package/lib/bs/src/QueryDbStorage_Postgres.res.mjs +23 -8
- package/lib/bs/src/QueryEnginePostgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/QueryEnginePostgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/QueryEnginePostgres.ast +0 -0
- package/lib/bs/src/QueryEnginePostgres.res +175 -0
- package/lib/bs/src/QueryEnginePostgres.res.mjs +91 -0
- package/lib/bs/tests/PostgresIntegrationTest-ReventlessPostgres.cmi +0 -0
- package/lib/bs/tests/PostgresIntegrationTest-ReventlessPostgres.cmt +0 -0
- package/lib/bs/tests/PostgresIntegrationTest.ast +0 -0
- package/lib/bs/tests/PostgresIntegrationTest.res +68 -0
- package/lib/bs/tests/PostgresIntegrationTest.res.mjs +49 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest-ReventlessPostgres.cmi +0 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest-ReventlessPostgres.cmj +0 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest-ReventlessPostgres.cmt +0 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest.ast +0 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest.res +236 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest.res.mjs +325 -0
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/DcbEventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/EventLogChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/EventLogChangeFeed-ReventlessPostgres.cmj +0 -0
- package/lib/ocaml/EventLogChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/EventLogChangeFeed.ast +0 -0
- package/lib/ocaml/EventLogChangeFeed.res +184 -0
- package/lib/ocaml/EventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/EventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/PgChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgSchema-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/PgSchema-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgSchema.ast +0 -0
- package/lib/ocaml/PgSchema.res +36 -2
- package/lib/ocaml/PostgresIntegrationTest-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/PostgresIntegrationTest-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PostgresIntegrationTest.ast +0 -0
- package/lib/ocaml/PostgresIntegrationTest.res +68 -0
- package/lib/ocaml/QueryDbStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres-ReventlessPostgres.cmj +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres.ast +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres.res +35 -14
- package/lib/ocaml/QueryEnginePostgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryEnginePostgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/QueryEnginePostgres.ast +0 -0
- package/lib/ocaml/QueryEnginePostgres.res +175 -0
- package/lib/ocaml/QueryEnginePostgresListPageTest-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryEnginePostgresListPageTest-ReventlessPostgres.cmj +0 -0
- package/lib/ocaml/QueryEnginePostgresListPageTest-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/QueryEnginePostgresListPageTest.ast +0 -0
- package/lib/ocaml/QueryEnginePostgresListPageTest.res +236 -0
- package/lib/ocaml/ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/ReventlessPostgres.mlmap +2 -0
- package/package.json +7 -7
- package/src/EventLogChangeFeed.res +184 -0
- package/src/EventLogChangeFeed.res.mjs +134 -0
- package/src/PgSchema.res +36 -2
- package/src/PgSchema.res.mjs +9 -2
- package/src/QueryDbStorage_Postgres.res +35 -14
- package/src/QueryDbStorage_Postgres.res.mjs +23 -8
- package/src/QueryEnginePostgres.res +175 -0
- package/src/QueryEnginePostgres.res.mjs +91 -0
- package/tests/PostgresIntegrationTest.res +68 -0
- package/tests/PostgresIntegrationTest.res.mjs +49 -0
- package/tests/QueryEnginePostgresListPageTest.res +236 -0
- package/tests/QueryEnginePostgresListPageTest.res.mjs +325 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// Parity harness for the Postgres connection-list push-down (B3.2a-1).
|
|
2
|
+
//
|
|
3
|
+
// `QueryEnginePostgres.listPage` builds `item->>'field'` predicates + keyset
|
|
4
|
+
// WHERE + ORDER BY … LIMIT to serve a page without materialising the whole read
|
|
5
|
+
// model. Its result MUST equal `QueryDbListQuery.run` (the shared spec in
|
|
6
|
+
// reventless-core that the in-memory backend, the SQLite push-down, and the
|
|
7
|
+
// resolver fallback all use) for every shape it claims to handle. This is the
|
|
8
|
+
// Postgres twin of reventless-local's `QueryDbListPushdownParityTest` — same
|
|
9
|
+
// capability, same rows, same (data, args) matrix — so all three backends are
|
|
10
|
+
// held to one spec.
|
|
11
|
+
//
|
|
12
|
+
// Skipped unless PG_URL is set (like PostgresIntegrationTest), so the default
|
|
13
|
+
// `pnpm test` stays dependency-free. Run with e.g.:
|
|
14
|
+
// PG_URL=postgres://postgres:postgres@localhost:5432/postgres pnpm test
|
|
15
|
+
|
|
16
|
+
open JestGlobals
|
|
17
|
+
open ReventlessCore
|
|
18
|
+
|
|
19
|
+
@val external processEnv: dict<string> = "process.env"
|
|
20
|
+
|
|
21
|
+
let capability: GraphQL_FragmentGenerator.serverCapability = {
|
|
22
|
+
filterFields: [
|
|
23
|
+
{name: "status", gqlType: "String", range: false},
|
|
24
|
+
{name: "qty", gqlType: "Int", range: true},
|
|
25
|
+
],
|
|
26
|
+
sortFields: ["name", "qty", "status"],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let mk = (id, status, name, qty) => {
|
|
30
|
+
let o = Dict.make()
|
|
31
|
+
o->Dict.set("id", JSON.Encode.string(id))
|
|
32
|
+
o->Dict.set("status", JSON.Encode.string(status))
|
|
33
|
+
o->Dict.set("name", JSON.Encode.string(name))
|
|
34
|
+
o->Dict.set("qty", JSON.Encode.int(qty))
|
|
35
|
+
JSON.Encode.object(o)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Names differ from id-order; status has duplicates (tiebreak); qty exercises the
|
|
39
|
+
// numeric-field-as-string comparison the push-down must match.
|
|
40
|
+
let rows = [
|
|
41
|
+
("p-1", "active", "Charlie", 3),
|
|
42
|
+
("p-2", "active", "Alpha", 1),
|
|
43
|
+
("p-3", "inactive", "Echo", 5),
|
|
44
|
+
("p-4", "active", "Bravo", 2),
|
|
45
|
+
("p-5", "inactive", "Delta", 4),
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
// The exact items seeded, in memory — the spec runs over these (equivalent to a
|
|
49
|
+
// full scan of the table, since every save upserts one of these by id).
|
|
50
|
+
let seededItems = rows->Array.map(((id, status, name, qty)) => mk(id, status, name, qty))
|
|
51
|
+
|
|
52
|
+
// ── normalise a connection to a comparable value ────────────────────────────
|
|
53
|
+
type normEdge = {id: string, cursor: string}
|
|
54
|
+
type normConn = {
|
|
55
|
+
edges: array<normEdge>,
|
|
56
|
+
hasNext: bool,
|
|
57
|
+
hasPrev: bool,
|
|
58
|
+
startCursor: option<string>,
|
|
59
|
+
endCursor: option<string>,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let field = (j, k) => j->JSON.Decode.object->Option.flatMap(d => d->Dict.get(k))
|
|
63
|
+
let str = (j, k) => j->field(k)->Option.flatMap(JSON.Decode.string)
|
|
64
|
+
|
|
65
|
+
let norm = (conn: JSON.t): normConn => {
|
|
66
|
+
let edges =
|
|
67
|
+
conn
|
|
68
|
+
->field("edges")
|
|
69
|
+
->Option.flatMap(JSON.Decode.array)
|
|
70
|
+
->Option.getOr([])
|
|
71
|
+
->Array.map(e => {
|
|
72
|
+
id: e->field("node")->Option.flatMap(n => n->str("id"))->Option.getOr(""),
|
|
73
|
+
cursor: e->str("cursor")->Option.getOr(""),
|
|
74
|
+
})
|
|
75
|
+
let pi = conn->field("pageInfo")->Option.getOr(JSON.Encode.null)
|
|
76
|
+
{
|
|
77
|
+
edges,
|
|
78
|
+
hasNext: pi->field("hasNextPage")->Option.flatMap(JSON.Decode.bool)->Option.getOr(false),
|
|
79
|
+
hasPrev: pi->field("hasPreviousPage")->Option.flatMap(JSON.Decode.bool)->Option.getOr(false),
|
|
80
|
+
startCursor: pi->str("startCursor"),
|
|
81
|
+
endCursor: pi->str("endCursor"),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let argsOf = (entries: array<(string, JSON.t)>): dict<JSON.t> => Dict.fromArray(entries)
|
|
86
|
+
let filterOf = (entries: array<(string, JSON.t)>): JSON.t =>
|
|
87
|
+
JSON.Encode.object(Dict.fromArray(entries))
|
|
88
|
+
let orderBy = (f, dir) =>
|
|
89
|
+
JSON.Encode.object(
|
|
90
|
+
Dict.fromArray([("field", JSON.Encode.string(f)), ("direction", JSON.Encode.string(dir))]),
|
|
91
|
+
)
|
|
92
|
+
let cur = QueryDbListQuery.encodeCursor
|
|
93
|
+
|
|
94
|
+
let expectedFor = argsDict =>
|
|
95
|
+
QueryDbListQuery.run(
|
|
96
|
+
~items=seededItems,
|
|
97
|
+
~argsDict,
|
|
98
|
+
~capability,
|
|
99
|
+
~labelField="name",
|
|
100
|
+
~decodeLocalId=_ => None,
|
|
101
|
+
)->norm
|
|
102
|
+
|
|
103
|
+
switch processEnv->Dict.get("PG_URL") {
|
|
104
|
+
| None =>
|
|
105
|
+
testSync("Postgres list push-down parity (skipped — set PG_URL to run)", () =>
|
|
106
|
+
expect(true)->toBe(true)
|
|
107
|
+
)
|
|
108
|
+
| Some(url) =>
|
|
109
|
+
let pool = PgDriver.makePool({connectionString: url})
|
|
110
|
+
module Eng = QueryEnginePostgres.Make({
|
|
111
|
+
let pool = pool
|
|
112
|
+
})
|
|
113
|
+
let name = "listparity"
|
|
114
|
+
|
|
115
|
+
// Seed via the real storage ops (upsert by id → table converges to the 5 rows).
|
|
116
|
+
beforeAllAsync(async () => {
|
|
117
|
+
let ops = QueryDbStorage_Postgres.makeOperations(~pool, ~name, ~indexes=[], ~subIdField=None)
|
|
118
|
+
for i in 0 to rows->Array.length - 1 {
|
|
119
|
+
let (id, status, nm, qty) = rows->Array.getUnsafe(i)
|
|
120
|
+
let _ = await ops.save(id, mk(id, status, nm, qty), QueryDb.Any, None)
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
afterAll(() => {
|
|
124
|
+
let _ = pool->PgDriver.endPool
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
// Assert the push-down serves this shape AND matches the spec exactly.
|
|
128
|
+
let checkPushed = async (~label, args) => {
|
|
129
|
+
let argsDict = argsOf(args)
|
|
130
|
+
switch await Eng.listPage(~readModelName=name, ~argsDict, ~capability, ~labelField="name") {
|
|
131
|
+
| Some(actual) => expect(actual->norm)->toEqual(expectedFor(argsDict))
|
|
132
|
+
| None => expect("push-down for " ++ label)->toBe("returned None")
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Assert the push-down declines this shape (resolver falls back to the spec).
|
|
137
|
+
let checkFallback = async args => {
|
|
138
|
+
let r = await Eng.listPage(~readModelName=name, ~argsDict=argsOf(args), ~capability, ~labelField="name")
|
|
139
|
+
expect(r->Option.isSome)->toBe(false)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
describe("QueryDb list push-down parity (Postgres ≡ QueryDbListQuery spec)", () => {
|
|
143
|
+
testPromise("bare page", () => checkPushed(~label="bare", []))
|
|
144
|
+
testPromise("first:2", () => checkPushed(~label="first", [("first", JSON.Encode.int(2))]))
|
|
145
|
+
testPromise("first:2 + after", () =>
|
|
146
|
+
checkPushed(
|
|
147
|
+
~label="after",
|
|
148
|
+
[("first", JSON.Encode.int(2)), ("after", JSON.Encode.string(cur("p-2")))],
|
|
149
|
+
)
|
|
150
|
+
)
|
|
151
|
+
testPromise("statusEq active", () =>
|
|
152
|
+
checkPushed(~label="eq", [("filter", filterOf([("statusEq", JSON.Encode.string("active"))]))])
|
|
153
|
+
)
|
|
154
|
+
testPromise("statusEq active + first:2", () =>
|
|
155
|
+
checkPushed(
|
|
156
|
+
~label="eq+first",
|
|
157
|
+
[
|
|
158
|
+
("filter", filterOf([("statusEq", JSON.Encode.string("active"))])),
|
|
159
|
+
("first", JSON.Encode.int(2)),
|
|
160
|
+
],
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
testPromise("orderBy name ASC", () =>
|
|
164
|
+
checkPushed(~label="order-asc", [("orderBy", orderBy("name", "ASC"))])
|
|
165
|
+
)
|
|
166
|
+
testPromise("orderBy name DESC", () =>
|
|
167
|
+
checkPushed(~label="order-desc", [("orderBy", orderBy("name", "DESC"))])
|
|
168
|
+
)
|
|
169
|
+
testPromise("orderBy name DESC + first:2 + after", () =>
|
|
170
|
+
checkPushed(
|
|
171
|
+
~label="order-desc-after",
|
|
172
|
+
[
|
|
173
|
+
("orderBy", orderBy("name", "DESC")),
|
|
174
|
+
("first", JSON.Encode.int(2)),
|
|
175
|
+
("after", JSON.Encode.string(cur("Delta"))),
|
|
176
|
+
],
|
|
177
|
+
)
|
|
178
|
+
)
|
|
179
|
+
// status has duplicate values → exercises the id tiebreak in ORDER BY.
|
|
180
|
+
testPromise("orderBy status ASC (tiebreak by id)", () =>
|
|
181
|
+
checkPushed(~label="order-tiebreak", [("orderBy", orderBy("status", "ASC"))])
|
|
182
|
+
)
|
|
183
|
+
// qty is numeric → exercises `item->>'qty'` (text) vs Float.toString string parity.
|
|
184
|
+
testPromise("qty range From/To (numeric-as-string)", () =>
|
|
185
|
+
checkPushed(
|
|
186
|
+
~label="range",
|
|
187
|
+
[
|
|
188
|
+
(
|
|
189
|
+
"filter",
|
|
190
|
+
filterOf([("qtyFrom", JSON.Encode.string("2")), ("qtyTo", JSON.Encode.string("4"))]),
|
|
191
|
+
),
|
|
192
|
+
],
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
testPromise("orderBy qty ASC (numeric-as-string sort)", () =>
|
|
196
|
+
checkPushed(~label="order-qty", [("orderBy", orderBy("qty", "ASC"))])
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
// Shapes the push-down declines → resolver uses the JS fallback.
|
|
200
|
+
testPromise("search → fallback", () =>
|
|
201
|
+
checkFallback([("filter", filterOf([("search", JSON.Encode.string("alp"))]))])
|
|
202
|
+
)
|
|
203
|
+
testPromise("searchPrefix → fallback", () =>
|
|
204
|
+
checkFallback([("filter", filterOf([("searchPrefix", JSON.Encode.string("A"))]))])
|
|
205
|
+
)
|
|
206
|
+
testPromise("ids → fallback", () =>
|
|
207
|
+
checkFallback([("filter", filterOf([("ids", JSON.Encode.array([JSON.Encode.string("p-1")]))]))])
|
|
208
|
+
)
|
|
209
|
+
testPromise("backward (last/before) → fallback", () =>
|
|
210
|
+
checkFallback([("last", JSON.Encode.int(2)), ("before", JSON.Encode.string(cur("p-4")))])
|
|
211
|
+
)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
// ── indexLookup / byIds push-downs ────────────────────────────────────────
|
|
215
|
+
let idsOf = (items: array<JSON.t>): array<string> =>
|
|
216
|
+
items->Array.filterMap(i => i->str("id"))->Array.toSorted(String.compare)
|
|
217
|
+
|
|
218
|
+
describe("QueryEnginePostgres index / batch push-downs", () => {
|
|
219
|
+
testPromise("indexLookup by status = active", async () => {
|
|
220
|
+
let items = await Eng.indexLookup(~readModelName=name, "status", "active")
|
|
221
|
+
expect(items->idsOf)->toEqual(["p-1", "p-2", "p-4"])
|
|
222
|
+
})
|
|
223
|
+
testPromise("indexLookup miss → empty", async () => {
|
|
224
|
+
let items = await Eng.indexLookup(~readModelName=name, "status", "nope")
|
|
225
|
+
expect(items->Array.length)->toBe(0)
|
|
226
|
+
})
|
|
227
|
+
testPromise("byIds returns matches, drops missing", async () => {
|
|
228
|
+
let items = await Eng.byIds(~readModelName=name, ["p-1", "p-3", "absent"])
|
|
229
|
+
expect(items->idsOf)->toEqual(["p-1", "p-3"])
|
|
230
|
+
})
|
|
231
|
+
testPromise("byIds [] → empty (no query)", async () => {
|
|
232
|
+
let items = await Eng.byIds(~readModelName=name, [])
|
|
233
|
+
expect(items->Array.length)->toBe(0)
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-postgres",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
4
|
"description": "Postgres storage backend for Reventless (classic + DCB event logs, query DB, change feed). Connection-string only — RDS/Aurora, any managed provider, or a local container.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"pg": "^8.13.1",
|
|
24
24
|
"sury": "11.0.0-alpha.4",
|
|
25
|
-
"@reventlessdev/rescript-
|
|
26
|
-
"@reventlessdev/
|
|
27
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.87",
|
|
28
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.5",
|
|
25
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.6",
|
|
26
|
+
"@reventlessdev/rescript-effect": "0.1.0-alpha.25",
|
|
29
27
|
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.14",
|
|
30
|
-
"@reventlessdev/reventless-
|
|
28
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.143",
|
|
29
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.89",
|
|
30
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.67"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/pg": "^8.11.10",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build": "rescript build",
|
|
51
51
|
"start": "rescript watch",
|
|
52
52
|
"clean": "rescript clean",
|
|
53
|
-
"rebuild": "pnpm run clean && pnpm run build
|
|
53
|
+
"rebuild": "pnpm run clean && pnpm run build",
|
|
54
54
|
"test": "NODE_OPTIONS='--experimental-vm-modules' npx jest"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Classic `event_log` change feed (B2.5) — the aggregate-path analogue of
|
|
2
|
+
// `PgChangeFeed` (which serves the DCB `dcb_event` log).
|
|
3
|
+
//
|
|
4
|
+
// Like the DCB feed this is NOT logical decoding: classic events are already
|
|
5
|
+
// durably queryable in-table, so the feed is an xmin-fenced read over `event_log`
|
|
6
|
+
// plus an `event_log_subscription` checkpoint. A statement-level AFTER INSERT
|
|
7
|
+
// trigger (`event_log_notify`, see PgSchema) issues `pg_notify('evlog_<log>')`,
|
|
8
|
+
// turning polling into near-real-time wakeup; a low-frequency fallback tick in the
|
|
9
|
+
// consumer covers missed notifications.
|
|
10
|
+
//
|
|
11
|
+
// Cursor semantics mirror the DCB feed exactly: the opaque `<xid8>:<global_seq>`
|
|
12
|
+
// string (zero-padded so string order == numeric order). Reads apply the xmin
|
|
13
|
+
// barrier (`transaction_id < pg_snapshot_xmin(pg_current_snapshot())`), so a
|
|
14
|
+
// returned cursor is stable forever — an event committed late (lower global_seq,
|
|
15
|
+
// later commit) is never skipped by a checkpointing reader. `global_seq` alone,
|
|
16
|
+
// being an IDENTITY assigned at INSERT, could NOT provide that guarantee.
|
|
17
|
+
|
|
18
|
+
// Reuse the shared `<a>:<b>` cursor codec from the DCB storage — identical format.
|
|
19
|
+
module Dcb = DcbEventLogStorage_Postgres
|
|
20
|
+
|
|
21
|
+
// One classic event as the feed surfaces it. `payload` is the stored event JSON
|
|
22
|
+
// verbatim; a bus/topic relay transforms it into its target shape (e.g. the AWS
|
|
23
|
+
// EventCollector `{id, meta, event}` body) — that transform is not this package's
|
|
24
|
+
// concern.
|
|
25
|
+
type classicEvent = {
|
|
26
|
+
cursor: string,
|
|
27
|
+
aggregateId: string,
|
|
28
|
+
seqNr: int,
|
|
29
|
+
payload: JSON.t,
|
|
30
|
+
msgId: option<string>,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// One page of the feed. `events` are in (transaction_id, global_seq) order;
|
|
34
|
+
// `cursor` is the checkpoint to persist and to pass as the next `after` (None when
|
|
35
|
+
// the page was empty — nothing new).
|
|
36
|
+
type batch = {
|
|
37
|
+
events: array<classicEvent>,
|
|
38
|
+
cursor: option<string>,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let selectColumns = "
|
|
42
|
+
lpad(transaction_id::text, 20, '0') || ':' || lpad(global_seq::text, 20, '0') AS cursor,
|
|
43
|
+
aggregate_id,
|
|
44
|
+
seq_nr,
|
|
45
|
+
payload,
|
|
46
|
+
msg_id
|
|
47
|
+
"
|
|
48
|
+
|
|
49
|
+
let coerceInt = (v: JSON.t): int =>
|
|
50
|
+
switch v {
|
|
51
|
+
| JSON.Number(n) => Float.toInt(n)
|
|
52
|
+
| JSON.String(s) => s->Int.fromString->Option.getOr(0)
|
|
53
|
+
| _ => 0
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let rowToEvent = (row: dict<JSON.t>): classicEvent => {
|
|
57
|
+
let str = key =>
|
|
58
|
+
switch row->Dict.get(key) {
|
|
59
|
+
| Some(JSON.String(s)) => s
|
|
60
|
+
| _ => ""
|
|
61
|
+
}
|
|
62
|
+
{
|
|
63
|
+
cursor: str("cursor"),
|
|
64
|
+
aggregateId: str("aggregate_id"),
|
|
65
|
+
seqNr: row->Dict.get("seq_nr")->Option.map(coerceInt)->Option.getOr(0),
|
|
66
|
+
payload: row->Dict.get("payload")->Option.getOr(JSON.Encode.null),
|
|
67
|
+
msgId: switch row->Dict.get("msg_id") {
|
|
68
|
+
| Some(JSON.String(s)) => Some(s)
|
|
69
|
+
| _ => None
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Read up to `limit` events after `after` (the xmin-fenced feed query — whole log).
|
|
75
|
+
// Returns the events and the cursor of the last one.
|
|
76
|
+
let readBatch = async (
|
|
77
|
+
pool: PgDriver.pool,
|
|
78
|
+
~logName: string,
|
|
79
|
+
~after: option<string>=?,
|
|
80
|
+
~limit: int=500,
|
|
81
|
+
): batch => {
|
|
82
|
+
let params = [JSON.Encode.string(logName)]
|
|
83
|
+
let where = ref("log_name = $1 AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())")
|
|
84
|
+
switch after->Option.flatMap(Dcb.decodeCursor) {
|
|
85
|
+
| Some((tx, pos)) =>
|
|
86
|
+
// $2 = tx (referenced twice), $3 = global_seq.
|
|
87
|
+
params->Array.push(JSON.Encode.string(tx))
|
|
88
|
+
params->Array.push(JSON.Encode.string(pos))
|
|
89
|
+
where :=
|
|
90
|
+
where.contents ++
|
|
91
|
+
" AND (transaction_id > $2::xid8 OR (transaction_id = $2::xid8 AND global_seq > $3::bigint))"
|
|
92
|
+
| None => ()
|
|
93
|
+
}
|
|
94
|
+
let sql = `SELECT ${selectColumns} FROM event_log WHERE ${where.contents} ORDER BY transaction_id ASC, global_seq ASC LIMIT ${Int.toString(limit)}`
|
|
95
|
+
let rows = await pool->PgDriver.query(sql, params)
|
|
96
|
+
let events = rows->Array.map(rowToEvent)
|
|
97
|
+
let cursor = switch events->Array.get(events->Array.length - 1) {
|
|
98
|
+
| Some(last) => Some(last.cursor)
|
|
99
|
+
| None => None
|
|
100
|
+
}
|
|
101
|
+
{events, cursor}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// --- Checkpoint contract (event_log_subscription) ---
|
|
105
|
+
|
|
106
|
+
// The persisted checkpoint for `subscriber`, encoded as a cursor, or None if the
|
|
107
|
+
// subscriber has never committed (→ replay from the beginning).
|
|
108
|
+
let loadCheckpoint = async (pool: PgDriver.pool, ~subscriber: string): option<string> =>
|
|
109
|
+
switch await pool->PgDriver.queryOne(
|
|
110
|
+
"SELECT lpad(last_tx::text, 20, '0') || ':' || lpad(last_global_seq::text, 20, '0') AS cursor
|
|
111
|
+
FROM event_log_subscription WHERE subscriber = $1 AND last_global_seq > 0",
|
|
112
|
+
[JSON.Encode.string(subscriber)],
|
|
113
|
+
) {
|
|
114
|
+
| Some(row) =>
|
|
115
|
+
switch row->Dict.get("cursor") {
|
|
116
|
+
| Some(JSON.String(s)) => Some(s)
|
|
117
|
+
| _ => None
|
|
118
|
+
}
|
|
119
|
+
| None => None
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Persist the checkpoint. Idempotent upsert; decodes the cursor to its two columns
|
|
123
|
+
// so a later `loadCheckpoint` round-trips exactly.
|
|
124
|
+
let saveCheckpoint = async (pool: PgDriver.pool, ~subscriber: string, ~cursor: string): unit =>
|
|
125
|
+
switch Dcb.decodeCursor(cursor) {
|
|
126
|
+
| Some((tx, pos)) =>
|
|
127
|
+
let _ = await pool->PgDriver.query(
|
|
128
|
+
"INSERT INTO event_log_subscription(subscriber, last_tx, last_global_seq)
|
|
129
|
+
VALUES ($1, $2::xid8, $3::bigint)
|
|
130
|
+
ON CONFLICT (subscriber)
|
|
131
|
+
DO UPDATE SET last_tx = EXCLUDED.last_tx, last_global_seq = EXCLUDED.last_global_seq",
|
|
132
|
+
[JSON.Encode.string(subscriber), JSON.Encode.string(tx), JSON.Encode.string(pos)],
|
|
133
|
+
)
|
|
134
|
+
| None => ()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// --- Wakeup ---
|
|
138
|
+
|
|
139
|
+
// LISTEN on `evlog_<logName>`; `onWake` fires on every notification. Returns the
|
|
140
|
+
// dedicated client (caller owns it — release via unlisten). Pair with a
|
|
141
|
+
// low-frequency fallback tick so a missed NOTIFY only adds latency, never a stall.
|
|
142
|
+
let listen = (pool: PgDriver.pool, ~logName: string, ~onWake: unit => unit): promise<
|
|
143
|
+
PgDriver.client,
|
|
144
|
+
> => pool->PgDriver.listen(~channel="evlog_" ++ logName, ~onNotify=_ => onWake())
|
|
145
|
+
|
|
146
|
+
let unlisten = (client: PgDriver.client, ~logName: string): promise<unit> =>
|
|
147
|
+
client->PgDriver.unlisten(~channel="evlog_" ++ logName)
|
|
148
|
+
|
|
149
|
+
// --- Reference consumer driver ---
|
|
150
|
+
|
|
151
|
+
// Drain the feed for `subscriber` from its checkpoint: repeatedly readBatch →
|
|
152
|
+
// `handle` the events → saveCheckpoint, until a short page. `handle` must be
|
|
153
|
+
// idempotent (a crash between handle and checkpoint replays the last batch).
|
|
154
|
+
// Returns the number of events processed.
|
|
155
|
+
let drain = async (
|
|
156
|
+
pool: PgDriver.pool,
|
|
157
|
+
~logName: string,
|
|
158
|
+
~subscriber: string,
|
|
159
|
+
~limit: int=500,
|
|
160
|
+
~handle: array<classicEvent> => promise<unit>,
|
|
161
|
+
): int => {
|
|
162
|
+
let processed = ref(0)
|
|
163
|
+
let cursor = ref(await loadCheckpoint(pool, ~subscriber))
|
|
164
|
+
let continue = ref(true)
|
|
165
|
+
while continue.contents {
|
|
166
|
+
let {events, cursor: newCursor} = await readBatch(pool, ~logName, ~after=?cursor.contents, ~limit)
|
|
167
|
+
if events->Array.length == 0 {
|
|
168
|
+
continue := false
|
|
169
|
+
} else {
|
|
170
|
+
await handle(events)
|
|
171
|
+
switch newCursor {
|
|
172
|
+
| Some(c) =>
|
|
173
|
+
await saveCheckpoint(pool, ~subscriber, ~cursor=c)
|
|
174
|
+
cursor := Some(c)
|
|
175
|
+
| None => ()
|
|
176
|
+
}
|
|
177
|
+
processed := processed.contents + events->Array.length
|
|
178
|
+
if events->Array.length < limit {
|
|
179
|
+
continue := false
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
processed.contents
|
|
184
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Int from "@rescript/runtime/lib/es6/Stdlib_Int.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as PgDriver$ReventlessPostgres from "./PgDriver.res.mjs";
|
|
6
|
+
import * as DcbEventLogStorage_Postgres$ReventlessPostgres from "./DcbEventLogStorage_Postgres.res.mjs";
|
|
7
|
+
|
|
8
|
+
let selectColumns = "\n lpad(transaction_id::text, 20, '0') || ':' || lpad(global_seq::text, 20, '0') AS cursor,\n aggregate_id,\n seq_nr,\n payload,\n msg_id\n";
|
|
9
|
+
|
|
10
|
+
function coerceInt(v) {
|
|
11
|
+
switch (typeof v) {
|
|
12
|
+
case "string" :
|
|
13
|
+
return Stdlib_Option.getOr(Stdlib_Int.fromString(v, undefined), 0);
|
|
14
|
+
case "number" :
|
|
15
|
+
return v | 0;
|
|
16
|
+
default:
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function rowToEvent(row) {
|
|
22
|
+
let str = key => {
|
|
23
|
+
let match = row[key];
|
|
24
|
+
if (typeof match === "string") {
|
|
25
|
+
return match;
|
|
26
|
+
} else {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
let match = row["msg_id"];
|
|
31
|
+
let tmp;
|
|
32
|
+
tmp = typeof match === "string" ? match : undefined;
|
|
33
|
+
return {
|
|
34
|
+
cursor: str("cursor"),
|
|
35
|
+
aggregateId: str("aggregate_id"),
|
|
36
|
+
seqNr: Stdlib_Option.getOr(Stdlib_Option.map(row["seq_nr"], coerceInt), 0),
|
|
37
|
+
payload: Stdlib_Option.getOr(row["payload"], null),
|
|
38
|
+
msgId: tmp
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function readBatch(pool, logName, after, limitOpt) {
|
|
43
|
+
let limit = limitOpt !== undefined ? limitOpt : 500;
|
|
44
|
+
let params = [logName];
|
|
45
|
+
let where = "log_name = $1 AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())";
|
|
46
|
+
let match = Stdlib_Option.flatMap(after, DcbEventLogStorage_Postgres$ReventlessPostgres.decodeCursor);
|
|
47
|
+
if (match !== undefined) {
|
|
48
|
+
params.push(match[0]);
|
|
49
|
+
params.push(match[1]);
|
|
50
|
+
where = where + " AND (transaction_id > $2::xid8 OR (transaction_id = $2::xid8 AND global_seq > $3::bigint))";
|
|
51
|
+
}
|
|
52
|
+
let sql = `SELECT ` + selectColumns + ` FROM event_log WHERE ` + where + ` ORDER BY transaction_id ASC, global_seq ASC LIMIT ` + limit.toString();
|
|
53
|
+
let rows = await PgDriver$ReventlessPostgres.query(pool, sql, params);
|
|
54
|
+
let events = rows.map(rowToEvent);
|
|
55
|
+
let last = events[events.length - 1 | 0];
|
|
56
|
+
let cursor = last !== undefined ? last.cursor : undefined;
|
|
57
|
+
return {
|
|
58
|
+
events: events,
|
|
59
|
+
cursor: cursor
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function loadCheckpoint(pool, subscriber) {
|
|
64
|
+
let row = await PgDriver$ReventlessPostgres.queryOne(pool, "SELECT lpad(last_tx::text, 20, '0') || ':' || lpad(last_global_seq::text, 20, '0') AS cursor\n FROM event_log_subscription WHERE subscriber = $1 AND last_global_seq > 0", [subscriber]);
|
|
65
|
+
if (row === undefined) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let match = row["cursor"];
|
|
69
|
+
if (typeof match === "string") {
|
|
70
|
+
return match;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function saveCheckpoint(pool, subscriber, cursor) {
|
|
75
|
+
let match = DcbEventLogStorage_Postgres$ReventlessPostgres.decodeCursor(cursor);
|
|
76
|
+
if (match !== undefined) {
|
|
77
|
+
await PgDriver$ReventlessPostgres.query(pool, "INSERT INTO event_log_subscription(subscriber, last_tx, last_global_seq)\n VALUES ($1, $2::xid8, $3::bigint)\n ON CONFLICT (subscriber)\n DO UPDATE SET last_tx = EXCLUDED.last_tx, last_global_seq = EXCLUDED.last_global_seq", [
|
|
78
|
+
subscriber,
|
|
79
|
+
match[0],
|
|
80
|
+
match[1]
|
|
81
|
+
]);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function listen(pool, logName, onWake) {
|
|
87
|
+
return PgDriver$ReventlessPostgres.listen(pool, "evlog_" + logName, param => onWake());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function unlisten(client, logName) {
|
|
91
|
+
return PgDriver$ReventlessPostgres.unlisten(client, "evlog_" + logName);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function drain(pool, logName, subscriber, limitOpt, handle) {
|
|
95
|
+
let limit = limitOpt !== undefined ? limitOpt : 500;
|
|
96
|
+
let processed = 0;
|
|
97
|
+
let cursor = await loadCheckpoint(pool, subscriber);
|
|
98
|
+
let $$continue = true;
|
|
99
|
+
while ($$continue) {
|
|
100
|
+
let match = await readBatch(pool, logName, cursor, limit);
|
|
101
|
+
let events = match.events;
|
|
102
|
+
if (events.length === 0) {
|
|
103
|
+
$$continue = false;
|
|
104
|
+
} else {
|
|
105
|
+
let newCursor = match.cursor;
|
|
106
|
+
await handle(events);
|
|
107
|
+
if (newCursor !== undefined) {
|
|
108
|
+
await saveCheckpoint(pool, subscriber, newCursor);
|
|
109
|
+
cursor = newCursor;
|
|
110
|
+
}
|
|
111
|
+
processed = processed + events.length | 0;
|
|
112
|
+
if (events.length < limit) {
|
|
113
|
+
$$continue = false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return processed;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let Dcb;
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Dcb,
|
|
124
|
+
selectColumns,
|
|
125
|
+
coerceInt,
|
|
126
|
+
rowToEvent,
|
|
127
|
+
readBatch,
|
|
128
|
+
loadCheckpoint,
|
|
129
|
+
saveCheckpoint,
|
|
130
|
+
listen,
|
|
131
|
+
unlisten,
|
|
132
|
+
drain,
|
|
133
|
+
}
|
|
134
|
+
/* PgDriver-ReventlessPostgres Not a pure module */
|
package/src/PgSchema.res
CHANGED
|
@@ -36,6 +36,19 @@ let tableStatements = [
|
|
|
36
36
|
schema_hash text NOT NULL,
|
|
37
37
|
PRIMARY KEY (log_name, aggregate_id)
|
|
38
38
|
)",
|
|
39
|
+
// --- Classic change feed (B2.5) ---
|
|
40
|
+
// Stamp every classic event with its committing xid8 so the feed can apply the
|
|
41
|
+
// same xmin read barrier the DCB feed uses — global_seq (an IDENTITY assigned at
|
|
42
|
+
// INSERT, before commit) is unsafe as a feed cursor on its own (a late-committing
|
|
43
|
+
// lower global_seq would be skipped). Idempotent; the volatile default auto-stamps
|
|
44
|
+
// every future insert with no change to EventLogStorage_Postgres.append.
|
|
45
|
+
"ALTER TABLE event_log ADD COLUMN IF NOT EXISTS transaction_id xid8 NOT NULL DEFAULT pg_current_xact_id()",
|
|
46
|
+
"CREATE INDEX IF NOT EXISTS event_log_tx_gseq ON event_log (log_name, transaction_id, global_seq)",
|
|
47
|
+
"CREATE TABLE IF NOT EXISTS event_log_subscription (
|
|
48
|
+
subscriber text PRIMARY KEY,
|
|
49
|
+
last_tx xid8 NOT NULL DEFAULT '0'::xid8,
|
|
50
|
+
last_global_seq bigint NOT NULL DEFAULT 0
|
|
51
|
+
)",
|
|
39
52
|
// --- DCB event log (Phase B) ---
|
|
40
53
|
"CREATE TABLE IF NOT EXISTS dcb_event (
|
|
41
54
|
log_name text NOT NULL,
|
|
@@ -236,7 +249,28 @@ END;
|
|
|
236
249
|
$fn$;
|
|
237
250
|
"
|
|
238
251
|
|
|
239
|
-
|
|
252
|
+
// Classic change-feed wakeup (B2.5). A statement-level AFTER INSERT trigger fires
|
|
253
|
+
// one pg_notify per distinct log_name touched by the statement, so the classic feed
|
|
254
|
+
// gets the same near-real-time wakeup the DCB append's inline pg_notify provides —
|
|
255
|
+
// without touching EventLogStorage_Postgres.append. No-op if nobody is LISTENing; a
|
|
256
|
+
// low-frequency fallback tick in the consumer covers missed notifications.
|
|
257
|
+
let eventLogNotifyFn = "
|
|
258
|
+
CREATE OR REPLACE FUNCTION event_log_notify() RETURNS trigger
|
|
259
|
+
LANGUAGE plpgsql AS $fn$
|
|
260
|
+
BEGIN
|
|
261
|
+
PERFORM pg_notify('evlog_' || log_name, '')
|
|
262
|
+
FROM (SELECT DISTINCT log_name FROM new_rows) s;
|
|
263
|
+
RETURN NULL;
|
|
264
|
+
END;
|
|
265
|
+
$fn$;
|
|
266
|
+
|
|
267
|
+
CREATE OR REPLACE TRIGGER event_log_notify_trg
|
|
268
|
+
AFTER INSERT ON event_log
|
|
269
|
+
REFERENCING NEW TABLE AS new_rows
|
|
270
|
+
FOR EACH STATEMENT EXECUTE FUNCTION event_log_notify();
|
|
271
|
+
"
|
|
272
|
+
|
|
273
|
+
let functionStatements = [dcbConditionWhereFn, dcbAppendFn, eventLogNotifyFn]
|
|
240
274
|
|
|
241
275
|
let ensureSchema = async (pool: PgDriver.pool): unit => {
|
|
242
276
|
for i in 0 to tableStatements->Array.length - 1 {
|
|
@@ -251,6 +285,6 @@ let ensureSchema = async (pool: PgDriver.pool): unit => {
|
|
|
251
285
|
// Mirrors the reventless-local contract that reset wipes data, not structure.
|
|
252
286
|
let truncateAll = async (pool: PgDriver.pool): unit => {
|
|
253
287
|
await pool->PgDriver.exec(
|
|
254
|
-
"TRUNCATE event_log, snapshot, dcb_event, dcb_scope, dcb_subscription RESTART IDENTITY",
|
|
288
|
+
"TRUNCATE event_log, snapshot, dcb_event, dcb_scope, dcb_subscription, event_log_subscription RESTART IDENTITY",
|
|
255
289
|
)
|
|
256
290
|
}
|