@livestore/common 0.4.0-dev.12 → 0.4.0-dev.13
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/dist/.tsbuildinfo +1 -1
- package/dist/devtools/devtools-messages-client-session.d.ts +21 -21
- package/dist/devtools/devtools-messages-common.d.ts +6 -6
- package/dist/devtools/devtools-messages-leader.d.ts +24 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/leader-thread/eventlog.js +2 -1
- package/dist/leader-thread/eventlog.js.map +1 -1
- package/dist/schema/mod.d.ts +1 -1
- package/dist/schema/mod.d.ts.map +1 -1
- package/dist/schema/mod.js +1 -1
- package/dist/schema/mod.js.map +1 -1
- package/dist/schema/schema.js +1 -1
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/state/sqlite/column-def.js +9 -0
- package/dist/schema/state/sqlite/column-def.js.map +1 -1
- package/dist/schema/state/sqlite/column-def.test.js +10 -0
- package/dist/schema/state/sqlite/column-def.test.js.map +1 -1
- package/dist/schema/state/sqlite/mod.js +1 -1
- package/dist/schema/state/sqlite/mod.js.map +1 -1
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.d.ts +547 -0
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.d.ts.map +1 -0
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.js +54 -0
- package/dist/schema/state/sqlite/system-tables/eventlog-tables.js.map +1 -0
- package/dist/schema/state/sqlite/system-tables/mod.d.ts +3 -0
- package/dist/schema/state/sqlite/system-tables/mod.d.ts.map +1 -0
- package/dist/schema/state/sqlite/system-tables/mod.js +3 -0
- package/dist/schema/state/sqlite/system-tables/mod.js.map +1 -0
- package/dist/schema/state/sqlite/system-tables/state-tables.d.ts +456 -0
- package/dist/schema/state/sqlite/system-tables/state-tables.d.ts.map +1 -0
- package/dist/schema/state/sqlite/system-tables/state-tables.js +55 -0
- package/dist/schema/state/sqlite/system-tables/state-tables.js.map +1 -0
- package/dist/schema-management/migrations.d.ts +30 -0
- package/dist/schema-management/migrations.d.ts.map +1 -1
- package/dist/schema-management/migrations.js +31 -1
- package/dist/schema-management/migrations.js.map +1 -1
- package/dist/version.d.ts +15 -5
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +15 -5
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/leader-thread/eventlog.ts +2 -2
- package/src/schema/mod.ts +1 -1
- package/src/schema/schema.ts +1 -1
- package/src/schema/state/sqlite/column-def.test.ts +13 -0
- package/src/schema/state/sqlite/column-def.ts +16 -0
- package/src/schema/state/sqlite/mod.ts +1 -1
- package/src/schema/state/sqlite/system-tables/eventlog-tables.ts +64 -0
- package/src/schema/state/sqlite/system-tables/mod.ts +2 -0
- package/src/schema/state/sqlite/system-tables/state-tables.ts +69 -0
- package/src/schema-management/migrations.ts +33 -2
- package/src/version.ts +15 -5
- package/src/schema/state/sqlite/system-tables.ts +0 -106
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STATE DATABASE SYSTEM TABLES
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ SAFE TO CHANGE: State tables are automatically rebuilt from eventlog when schema changes.
|
|
5
|
+
* No need to bump `liveStoreStorageFormatVersion` (uses hash-based migration via SqliteAst.hash()).
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCHEMA_META_TABLE = "__livestore_schema";
|
|
8
|
+
/**
|
|
9
|
+
* Tracks schema hashes for user-defined tables to detect schema changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const schemaMetaTable: import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_schema", {
|
|
12
|
+
readonly tableName: {
|
|
13
|
+
columnType: "text";
|
|
14
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
15
|
+
default: import("effect/Option").None<never>;
|
|
16
|
+
nullable: false;
|
|
17
|
+
primaryKey: true;
|
|
18
|
+
autoIncrement: false;
|
|
19
|
+
};
|
|
20
|
+
readonly schemaHash: {
|
|
21
|
+
columnType: "integer";
|
|
22
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
23
|
+
default: import("effect/Option").None<never>;
|
|
24
|
+
nullable: false;
|
|
25
|
+
primaryKey: false;
|
|
26
|
+
autoIncrement: false;
|
|
27
|
+
};
|
|
28
|
+
/** ISO date format */
|
|
29
|
+
readonly updatedAt: {
|
|
30
|
+
columnType: "text";
|
|
31
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
32
|
+
default: import("effect/Option").None<never>;
|
|
33
|
+
nullable: false;
|
|
34
|
+
primaryKey: false;
|
|
35
|
+
autoIncrement: false;
|
|
36
|
+
};
|
|
37
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
38
|
+
readonly tableName: {
|
|
39
|
+
columnType: "text";
|
|
40
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
41
|
+
default: import("effect/Option").None<never>;
|
|
42
|
+
nullable: false;
|
|
43
|
+
primaryKey: true;
|
|
44
|
+
autoIncrement: false;
|
|
45
|
+
};
|
|
46
|
+
readonly schemaHash: {
|
|
47
|
+
columnType: "integer";
|
|
48
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
49
|
+
default: import("effect/Option").None<never>;
|
|
50
|
+
nullable: false;
|
|
51
|
+
primaryKey: false;
|
|
52
|
+
autoIncrement: false;
|
|
53
|
+
};
|
|
54
|
+
/** ISO date format */
|
|
55
|
+
readonly updatedAt: {
|
|
56
|
+
columnType: "text";
|
|
57
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
58
|
+
default: import("effect/Option").None<never>;
|
|
59
|
+
nullable: false;
|
|
60
|
+
primaryKey: false;
|
|
61
|
+
autoIncrement: false;
|
|
62
|
+
};
|
|
63
|
+
}>, import("effect/Schema").Schema<{
|
|
64
|
+
readonly tableName: string;
|
|
65
|
+
readonly schemaHash: number;
|
|
66
|
+
readonly updatedAt: string;
|
|
67
|
+
}, {
|
|
68
|
+
readonly tableName: string;
|
|
69
|
+
readonly schemaHash: number;
|
|
70
|
+
readonly updatedAt: string;
|
|
71
|
+
}, never>>;
|
|
72
|
+
export type SchemaMetaRow = typeof schemaMetaTable.Type;
|
|
73
|
+
export declare const SCHEMA_EVENT_DEFS_META_TABLE = "__livestore_schema_event_defs";
|
|
74
|
+
/**
|
|
75
|
+
* Tracks schema hashes for event definitions to detect event schema changes.
|
|
76
|
+
*/
|
|
77
|
+
export declare const schemaEventDefsMetaTable: import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_schema_event_defs", {
|
|
78
|
+
readonly eventName: {
|
|
79
|
+
columnType: "text";
|
|
80
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
81
|
+
default: import("effect/Option").None<never>;
|
|
82
|
+
nullable: false;
|
|
83
|
+
primaryKey: true;
|
|
84
|
+
autoIncrement: false;
|
|
85
|
+
};
|
|
86
|
+
readonly schemaHash: {
|
|
87
|
+
columnType: "integer";
|
|
88
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
89
|
+
default: import("effect/Option").None<never>;
|
|
90
|
+
nullable: false;
|
|
91
|
+
primaryKey: false;
|
|
92
|
+
autoIncrement: false;
|
|
93
|
+
};
|
|
94
|
+
/** ISO date format */
|
|
95
|
+
readonly updatedAt: {
|
|
96
|
+
columnType: "text";
|
|
97
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
98
|
+
default: import("effect/Option").None<never>;
|
|
99
|
+
nullable: false;
|
|
100
|
+
primaryKey: false;
|
|
101
|
+
autoIncrement: false;
|
|
102
|
+
};
|
|
103
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
104
|
+
readonly eventName: {
|
|
105
|
+
columnType: "text";
|
|
106
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
107
|
+
default: import("effect/Option").None<never>;
|
|
108
|
+
nullable: false;
|
|
109
|
+
primaryKey: true;
|
|
110
|
+
autoIncrement: false;
|
|
111
|
+
};
|
|
112
|
+
readonly schemaHash: {
|
|
113
|
+
columnType: "integer";
|
|
114
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
115
|
+
default: import("effect/Option").None<never>;
|
|
116
|
+
nullable: false;
|
|
117
|
+
primaryKey: false;
|
|
118
|
+
autoIncrement: false;
|
|
119
|
+
};
|
|
120
|
+
/** ISO date format */
|
|
121
|
+
readonly updatedAt: {
|
|
122
|
+
columnType: "text";
|
|
123
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
124
|
+
default: import("effect/Option").None<never>;
|
|
125
|
+
nullable: false;
|
|
126
|
+
primaryKey: false;
|
|
127
|
+
autoIncrement: false;
|
|
128
|
+
};
|
|
129
|
+
}>, import("effect/Schema").Schema<{
|
|
130
|
+
readonly eventName: string;
|
|
131
|
+
readonly schemaHash: number;
|
|
132
|
+
readonly updatedAt: string;
|
|
133
|
+
}, {
|
|
134
|
+
readonly eventName: string;
|
|
135
|
+
readonly schemaHash: number;
|
|
136
|
+
readonly updatedAt: string;
|
|
137
|
+
}, never>>;
|
|
138
|
+
export type SchemaEventDefsMetaRow = typeof schemaEventDefsMetaTable.Type;
|
|
139
|
+
/**
|
|
140
|
+
* Table which stores SQLite changeset blobs which is used for rolling back
|
|
141
|
+
* read-model state during rebasing.
|
|
142
|
+
*/
|
|
143
|
+
export declare const SESSION_CHANGESET_META_TABLE = "__livestore_session_changeset";
|
|
144
|
+
export declare const sessionChangesetMetaTable: import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_session_changeset", {
|
|
145
|
+
readonly seqNumGlobal: {
|
|
146
|
+
columnType: "integer";
|
|
147
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
|
|
148
|
+
default: import("effect/Option").None<never>;
|
|
149
|
+
nullable: false;
|
|
150
|
+
primaryKey: false;
|
|
151
|
+
autoIncrement: false;
|
|
152
|
+
};
|
|
153
|
+
readonly seqNumClient: {
|
|
154
|
+
columnType: "integer";
|
|
155
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
|
|
156
|
+
default: import("effect/Option").None<never>;
|
|
157
|
+
nullable: false;
|
|
158
|
+
primaryKey: false;
|
|
159
|
+
autoIncrement: false;
|
|
160
|
+
};
|
|
161
|
+
readonly seqNumRebaseGeneration: {
|
|
162
|
+
columnType: "integer";
|
|
163
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
164
|
+
default: import("effect/Option").None<never>;
|
|
165
|
+
nullable: false;
|
|
166
|
+
primaryKey: false;
|
|
167
|
+
autoIncrement: false;
|
|
168
|
+
};
|
|
169
|
+
readonly changeset: {
|
|
170
|
+
columnType: "blob";
|
|
171
|
+
schema: import("effect/Schema").Schema<Uint8Array<ArrayBuffer> | null, Uint8Array<ArrayBuffer> | null, never>;
|
|
172
|
+
default: import("effect/Option").None<never>;
|
|
173
|
+
nullable: true;
|
|
174
|
+
primaryKey: false;
|
|
175
|
+
autoIncrement: false;
|
|
176
|
+
};
|
|
177
|
+
readonly debug: {
|
|
178
|
+
columnType: "text";
|
|
179
|
+
schema: import("effect/Schema").Schema<unknown, string | null, never>;
|
|
180
|
+
default: import("effect/Option").Some<any> | import("effect/Option").None<never>;
|
|
181
|
+
nullable: true;
|
|
182
|
+
primaryKey: false;
|
|
183
|
+
autoIncrement: false;
|
|
184
|
+
};
|
|
185
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
186
|
+
readonly seqNumGlobal: {
|
|
187
|
+
columnType: "integer";
|
|
188
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
|
|
189
|
+
default: import("effect/Option").None<never>;
|
|
190
|
+
nullable: false;
|
|
191
|
+
primaryKey: false;
|
|
192
|
+
autoIncrement: false;
|
|
193
|
+
};
|
|
194
|
+
readonly seqNumClient: {
|
|
195
|
+
columnType: "integer";
|
|
196
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
|
|
197
|
+
default: import("effect/Option").None<never>;
|
|
198
|
+
nullable: false;
|
|
199
|
+
primaryKey: false;
|
|
200
|
+
autoIncrement: false;
|
|
201
|
+
};
|
|
202
|
+
readonly seqNumRebaseGeneration: {
|
|
203
|
+
columnType: "integer";
|
|
204
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
205
|
+
default: import("effect/Option").None<never>;
|
|
206
|
+
nullable: false;
|
|
207
|
+
primaryKey: false;
|
|
208
|
+
autoIncrement: false;
|
|
209
|
+
};
|
|
210
|
+
readonly changeset: {
|
|
211
|
+
columnType: "blob";
|
|
212
|
+
schema: import("effect/Schema").Schema<Uint8Array<ArrayBuffer> | null, Uint8Array<ArrayBuffer> | null, never>;
|
|
213
|
+
default: import("effect/Option").None<never>;
|
|
214
|
+
nullable: true;
|
|
215
|
+
primaryKey: false;
|
|
216
|
+
autoIncrement: false;
|
|
217
|
+
};
|
|
218
|
+
readonly debug: {
|
|
219
|
+
columnType: "text";
|
|
220
|
+
schema: import("effect/Schema").Schema<unknown, string | null, never>;
|
|
221
|
+
default: import("effect/Option").Some<any> | import("effect/Option").None<never>;
|
|
222
|
+
nullable: true;
|
|
223
|
+
primaryKey: false;
|
|
224
|
+
autoIncrement: false;
|
|
225
|
+
};
|
|
226
|
+
}>, import("effect/Schema").Schema<{
|
|
227
|
+
readonly seqNumGlobal: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
|
|
228
|
+
readonly seqNumClient: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
|
|
229
|
+
readonly seqNumRebaseGeneration: number;
|
|
230
|
+
readonly changeset: Uint8Array<ArrayBuffer> | null;
|
|
231
|
+
readonly debug: unknown;
|
|
232
|
+
}, {
|
|
233
|
+
readonly seqNumGlobal: number;
|
|
234
|
+
readonly seqNumClient: number;
|
|
235
|
+
readonly seqNumRebaseGeneration: number;
|
|
236
|
+
readonly changeset: Uint8Array<ArrayBuffer> | null;
|
|
237
|
+
readonly debug: string | null;
|
|
238
|
+
}, never>>;
|
|
239
|
+
export type SessionChangesetMetaRow = typeof sessionChangesetMetaTable.Type;
|
|
240
|
+
export declare const stateSystemTables: readonly [import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_schema", {
|
|
241
|
+
readonly tableName: {
|
|
242
|
+
columnType: "text";
|
|
243
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
244
|
+
default: import("effect/Option").None<never>;
|
|
245
|
+
nullable: false;
|
|
246
|
+
primaryKey: true;
|
|
247
|
+
autoIncrement: false;
|
|
248
|
+
};
|
|
249
|
+
readonly schemaHash: {
|
|
250
|
+
columnType: "integer";
|
|
251
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
252
|
+
default: import("effect/Option").None<never>;
|
|
253
|
+
nullable: false;
|
|
254
|
+
primaryKey: false;
|
|
255
|
+
autoIncrement: false;
|
|
256
|
+
};
|
|
257
|
+
/** ISO date format */
|
|
258
|
+
readonly updatedAt: {
|
|
259
|
+
columnType: "text";
|
|
260
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
261
|
+
default: import("effect/Option").None<never>;
|
|
262
|
+
nullable: false;
|
|
263
|
+
primaryKey: false;
|
|
264
|
+
autoIncrement: false;
|
|
265
|
+
};
|
|
266
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
267
|
+
readonly tableName: {
|
|
268
|
+
columnType: "text";
|
|
269
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
270
|
+
default: import("effect/Option").None<never>;
|
|
271
|
+
nullable: false;
|
|
272
|
+
primaryKey: true;
|
|
273
|
+
autoIncrement: false;
|
|
274
|
+
};
|
|
275
|
+
readonly schemaHash: {
|
|
276
|
+
columnType: "integer";
|
|
277
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
278
|
+
default: import("effect/Option").None<never>;
|
|
279
|
+
nullable: false;
|
|
280
|
+
primaryKey: false;
|
|
281
|
+
autoIncrement: false;
|
|
282
|
+
};
|
|
283
|
+
/** ISO date format */
|
|
284
|
+
readonly updatedAt: {
|
|
285
|
+
columnType: "text";
|
|
286
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
287
|
+
default: import("effect/Option").None<never>;
|
|
288
|
+
nullable: false;
|
|
289
|
+
primaryKey: false;
|
|
290
|
+
autoIncrement: false;
|
|
291
|
+
};
|
|
292
|
+
}>, import("effect/Schema").Schema<{
|
|
293
|
+
readonly tableName: string;
|
|
294
|
+
readonly schemaHash: number;
|
|
295
|
+
readonly updatedAt: string;
|
|
296
|
+
}, {
|
|
297
|
+
readonly tableName: string;
|
|
298
|
+
readonly schemaHash: number;
|
|
299
|
+
readonly updatedAt: string;
|
|
300
|
+
}, never>>, import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_schema_event_defs", {
|
|
301
|
+
readonly eventName: {
|
|
302
|
+
columnType: "text";
|
|
303
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
304
|
+
default: import("effect/Option").None<never>;
|
|
305
|
+
nullable: false;
|
|
306
|
+
primaryKey: true;
|
|
307
|
+
autoIncrement: false;
|
|
308
|
+
};
|
|
309
|
+
readonly schemaHash: {
|
|
310
|
+
columnType: "integer";
|
|
311
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
312
|
+
default: import("effect/Option").None<never>;
|
|
313
|
+
nullable: false;
|
|
314
|
+
primaryKey: false;
|
|
315
|
+
autoIncrement: false;
|
|
316
|
+
};
|
|
317
|
+
/** ISO date format */
|
|
318
|
+
readonly updatedAt: {
|
|
319
|
+
columnType: "text";
|
|
320
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
321
|
+
default: import("effect/Option").None<never>;
|
|
322
|
+
nullable: false;
|
|
323
|
+
primaryKey: false;
|
|
324
|
+
autoIncrement: false;
|
|
325
|
+
};
|
|
326
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
327
|
+
readonly eventName: {
|
|
328
|
+
columnType: "text";
|
|
329
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
330
|
+
default: import("effect/Option").None<never>;
|
|
331
|
+
nullable: false;
|
|
332
|
+
primaryKey: true;
|
|
333
|
+
autoIncrement: false;
|
|
334
|
+
};
|
|
335
|
+
readonly schemaHash: {
|
|
336
|
+
columnType: "integer";
|
|
337
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
338
|
+
default: import("effect/Option").None<never>;
|
|
339
|
+
nullable: false;
|
|
340
|
+
primaryKey: false;
|
|
341
|
+
autoIncrement: false;
|
|
342
|
+
};
|
|
343
|
+
/** ISO date format */
|
|
344
|
+
readonly updatedAt: {
|
|
345
|
+
columnType: "text";
|
|
346
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
347
|
+
default: import("effect/Option").None<never>;
|
|
348
|
+
nullable: false;
|
|
349
|
+
primaryKey: false;
|
|
350
|
+
autoIncrement: false;
|
|
351
|
+
};
|
|
352
|
+
}>, import("effect/Schema").Schema<{
|
|
353
|
+
readonly eventName: string;
|
|
354
|
+
readonly schemaHash: number;
|
|
355
|
+
readonly updatedAt: string;
|
|
356
|
+
}, {
|
|
357
|
+
readonly eventName: string;
|
|
358
|
+
readonly schemaHash: number;
|
|
359
|
+
readonly updatedAt: string;
|
|
360
|
+
}, never>>, import("../table-def.ts").TableDef<import("../table-def.ts").SqliteTableDefForInput<"__livestore_session_changeset", {
|
|
361
|
+
readonly seqNumGlobal: {
|
|
362
|
+
columnType: "integer";
|
|
363
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
|
|
364
|
+
default: import("effect/Option").None<never>;
|
|
365
|
+
nullable: false;
|
|
366
|
+
primaryKey: false;
|
|
367
|
+
autoIncrement: false;
|
|
368
|
+
};
|
|
369
|
+
readonly seqNumClient: {
|
|
370
|
+
columnType: "integer";
|
|
371
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
|
|
372
|
+
default: import("effect/Option").None<never>;
|
|
373
|
+
nullable: false;
|
|
374
|
+
primaryKey: false;
|
|
375
|
+
autoIncrement: false;
|
|
376
|
+
};
|
|
377
|
+
readonly seqNumRebaseGeneration: {
|
|
378
|
+
columnType: "integer";
|
|
379
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
380
|
+
default: import("effect/Option").None<never>;
|
|
381
|
+
nullable: false;
|
|
382
|
+
primaryKey: false;
|
|
383
|
+
autoIncrement: false;
|
|
384
|
+
};
|
|
385
|
+
readonly changeset: {
|
|
386
|
+
columnType: "blob";
|
|
387
|
+
schema: import("effect/Schema").Schema<Uint8Array<ArrayBuffer> | null, Uint8Array<ArrayBuffer> | null, never>;
|
|
388
|
+
default: import("effect/Option").None<never>;
|
|
389
|
+
nullable: true;
|
|
390
|
+
primaryKey: false;
|
|
391
|
+
autoIncrement: false;
|
|
392
|
+
};
|
|
393
|
+
readonly debug: {
|
|
394
|
+
columnType: "text";
|
|
395
|
+
schema: import("effect/Schema").Schema<unknown, string | null, never>;
|
|
396
|
+
default: import("effect/Option").Some<any> | import("effect/Option").None<never>;
|
|
397
|
+
nullable: true;
|
|
398
|
+
primaryKey: false;
|
|
399
|
+
autoIncrement: false;
|
|
400
|
+
};
|
|
401
|
+
}>, import("../table-def.ts").WithDefaults<{
|
|
402
|
+
readonly seqNumGlobal: {
|
|
403
|
+
columnType: "integer";
|
|
404
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
|
|
405
|
+
default: import("effect/Option").None<never>;
|
|
406
|
+
nullable: false;
|
|
407
|
+
primaryKey: false;
|
|
408
|
+
autoIncrement: false;
|
|
409
|
+
};
|
|
410
|
+
readonly seqNumClient: {
|
|
411
|
+
columnType: "integer";
|
|
412
|
+
schema: import("effect/Schema").Schema<number & import("effect/Brand").Brand<"ClientEventSequenceNumber">, number, never>;
|
|
413
|
+
default: import("effect/Option").None<never>;
|
|
414
|
+
nullable: false;
|
|
415
|
+
primaryKey: false;
|
|
416
|
+
autoIncrement: false;
|
|
417
|
+
};
|
|
418
|
+
readonly seqNumRebaseGeneration: {
|
|
419
|
+
columnType: "integer";
|
|
420
|
+
schema: import("effect/Schema").Schema<number, number, never>;
|
|
421
|
+
default: import("effect/Option").None<never>;
|
|
422
|
+
nullable: false;
|
|
423
|
+
primaryKey: false;
|
|
424
|
+
autoIncrement: false;
|
|
425
|
+
};
|
|
426
|
+
readonly changeset: {
|
|
427
|
+
columnType: "blob";
|
|
428
|
+
schema: import("effect/Schema").Schema<Uint8Array<ArrayBuffer> | null, Uint8Array<ArrayBuffer> | null, never>;
|
|
429
|
+
default: import("effect/Option").None<never>;
|
|
430
|
+
nullable: true;
|
|
431
|
+
primaryKey: false;
|
|
432
|
+
autoIncrement: false;
|
|
433
|
+
};
|
|
434
|
+
readonly debug: {
|
|
435
|
+
columnType: "text";
|
|
436
|
+
schema: import("effect/Schema").Schema<unknown, string | null, never>;
|
|
437
|
+
default: import("effect/Option").Some<any> | import("effect/Option").None<never>;
|
|
438
|
+
nullable: true;
|
|
439
|
+
primaryKey: false;
|
|
440
|
+
autoIncrement: false;
|
|
441
|
+
};
|
|
442
|
+
}>, import("effect/Schema").Schema<{
|
|
443
|
+
readonly seqNumGlobal: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
|
|
444
|
+
readonly seqNumClient: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
|
|
445
|
+
readonly seqNumRebaseGeneration: number;
|
|
446
|
+
readonly changeset: Uint8Array<ArrayBuffer> | null;
|
|
447
|
+
readonly debug: unknown;
|
|
448
|
+
}, {
|
|
449
|
+
readonly seqNumGlobal: number;
|
|
450
|
+
readonly seqNumClient: number;
|
|
451
|
+
readonly seqNumRebaseGeneration: number;
|
|
452
|
+
readonly changeset: Uint8Array<ArrayBuffer> | null;
|
|
453
|
+
readonly debug: string | null;
|
|
454
|
+
}, never>>];
|
|
455
|
+
export declare const isStateSystemTable: (tableName: string) => boolean;
|
|
456
|
+
//# sourceMappingURL=state-tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-tables.d.ts","sourceRoot":"","sources":["../../../../../src/schema/state/sqlite/system-tables/state-tables.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AAErD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;IAKxB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;IAAtB,sBAAsB;;;;;;;;;;;;;;;;;UAGxB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEvD,eAAO,MAAM,4BAA4B,kCAAkC,CAAA;AAE3E;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;IAKjC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;IAAtB,sBAAsB;;;;;;;;;;;;;;;;;UAGxB,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAA;AAEzE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,kCAAkC,CAAA;AAE3E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAWpC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAA;AAE3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;IA7C1B,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;IAAtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;IAAtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4BsF,CAAA;AAEhH,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,YAAkE,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as EventSequenceNumber from "../../../EventSequenceNumber.js";
|
|
2
|
+
import { SqliteDsl } from "../db-schema/mod.js";
|
|
3
|
+
import { table } from "../table-def.js";
|
|
4
|
+
/**
|
|
5
|
+
* STATE DATABASE SYSTEM TABLES
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ SAFE TO CHANGE: State tables are automatically rebuilt from eventlog when schema changes.
|
|
8
|
+
* No need to bump `liveStoreStorageFormatVersion` (uses hash-based migration via SqliteAst.hash()).
|
|
9
|
+
*/
|
|
10
|
+
export const SCHEMA_META_TABLE = '__livestore_schema';
|
|
11
|
+
/**
|
|
12
|
+
* Tracks schema hashes for user-defined tables to detect schema changes.
|
|
13
|
+
*/
|
|
14
|
+
export const schemaMetaTable = table({
|
|
15
|
+
name: SCHEMA_META_TABLE,
|
|
16
|
+
columns: {
|
|
17
|
+
tableName: SqliteDsl.text({ primaryKey: true }),
|
|
18
|
+
schemaHash: SqliteDsl.integer({ nullable: false }),
|
|
19
|
+
/** ISO date format */
|
|
20
|
+
updatedAt: SqliteDsl.text({ nullable: false }),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const SCHEMA_EVENT_DEFS_META_TABLE = '__livestore_schema_event_defs';
|
|
24
|
+
/**
|
|
25
|
+
* Tracks schema hashes for event definitions to detect event schema changes.
|
|
26
|
+
*/
|
|
27
|
+
export const schemaEventDefsMetaTable = table({
|
|
28
|
+
name: SCHEMA_EVENT_DEFS_META_TABLE,
|
|
29
|
+
columns: {
|
|
30
|
+
eventName: SqliteDsl.text({ primaryKey: true }),
|
|
31
|
+
schemaHash: SqliteDsl.integer({ nullable: false }),
|
|
32
|
+
/** ISO date format */
|
|
33
|
+
updatedAt: SqliteDsl.text({ nullable: false }),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Table which stores SQLite changeset blobs which is used for rolling back
|
|
38
|
+
* read-model state during rebasing.
|
|
39
|
+
*/
|
|
40
|
+
export const SESSION_CHANGESET_META_TABLE = '__livestore_session_changeset';
|
|
41
|
+
export const sessionChangesetMetaTable = table({
|
|
42
|
+
name: SESSION_CHANGESET_META_TABLE,
|
|
43
|
+
columns: {
|
|
44
|
+
// TODO bring back primary key
|
|
45
|
+
seqNumGlobal: SqliteDsl.integer({ schema: EventSequenceNumber.GlobalEventSequenceNumber }),
|
|
46
|
+
seqNumClient: SqliteDsl.integer({ schema: EventSequenceNumber.ClientEventSequenceNumber }),
|
|
47
|
+
seqNumRebaseGeneration: SqliteDsl.integer({}),
|
|
48
|
+
changeset: SqliteDsl.blob({ nullable: true }),
|
|
49
|
+
debug: SqliteDsl.json({ nullable: true }),
|
|
50
|
+
},
|
|
51
|
+
indexes: [{ columns: ['seqNumGlobal', 'seqNumClient'], name: 'idx_session_changeset_id' }],
|
|
52
|
+
});
|
|
53
|
+
export const stateSystemTables = [schemaMetaTable, schemaEventDefsMetaTable, sessionChangesetMetaTable];
|
|
54
|
+
export const isStateSystemTable = (tableName) => stateSystemTables.some((_) => _.sqliteDef.name === tableName);
|
|
55
|
+
//# sourceMappingURL=state-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-tables.js","sourceRoot":"","sources":["../../../../../src/schema/state/sqlite/system-tables/state-tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC;;;;;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B,EAAE,CAAC;QAC1F,sBAAsB,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7C,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC1C;IACD,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;CAC3F,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAe,EAAE,wBAAwB,EAAE,yBAAyB,CAAU,CAAA;AAEhH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA"}
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTOMATIC HASH-BASED SCHEMA MIGRATIONS
|
|
3
|
+
*
|
|
4
|
+
* This module implements automatic schema versioning using hash-based change detection.
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ CRITICAL DISTINCTION:
|
|
7
|
+
* - STATE TABLES (safe to modify): Changes trigger rematerialization from eventlog
|
|
8
|
+
* - EVENTLOG TABLES (NEVER modify): Changes cause data loss - need manual versioning!
|
|
9
|
+
*
|
|
10
|
+
* How it works:
|
|
11
|
+
* 1. Each table's schema is hashed using SqliteAst.hash()
|
|
12
|
+
* 2. Hashes are stored in SCHEMA_META_TABLE after successful migrations
|
|
13
|
+
* 3. On app start, current schema hashes are compared with stored hashes
|
|
14
|
+
* 4. Mismatches trigger migrations:
|
|
15
|
+
* - State tables: Recreated and repopulated from eventlog (safe, no data loss)
|
|
16
|
+
* - Eventlog tables: Uses 'create-if-not-exists' (UNSAFE - causes data loss!)
|
|
17
|
+
*
|
|
18
|
+
* State Table Changes (SAFE):
|
|
19
|
+
* - User-defined tables are rebuilt from eventlog
|
|
20
|
+
* - System tables (schemaMetaTable, etc.) are recreated
|
|
21
|
+
* - Data preserved through rematerializeFromEventlog()
|
|
22
|
+
*
|
|
23
|
+
* Eventlog Table Changes (UNSAFE):
|
|
24
|
+
* - eventlogMetaTable, syncStatusTable changes cause "soft reset"
|
|
25
|
+
* - Old table becomes inaccessible (but remains in DB)
|
|
26
|
+
* - No automatic migration - effectively data loss
|
|
27
|
+
* - TODO: Implement proper EVENTLOG_PERSISTENCE_FORMAT_VERSION system
|
|
28
|
+
*
|
|
29
|
+
* See system-tables/state-tables.ts and system-tables/eventlog-tables.ts for detailed documentation on each table type.
|
|
30
|
+
*/
|
|
1
31
|
import { Effect } from '@livestore/utils/effect';
|
|
2
32
|
import type { SqliteDb } from '../adapter-types.ts';
|
|
3
33
|
import type { MigrationsReport } from '../defs.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/schema-management/migrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/schema-management/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,YAAY,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAUnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAMhD,eAAO,MAAM,iBAAiB,GAAI,IAAI,QAAQ,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAuBxE,CAAA;AAGJ,eAAO,MAAM,SAAS,GAAI,6BAIvB;IACD,EAAE,EAAE,QAAQ,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CAC5E,KAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,eAAe,CA2D/C,CAAA;AAEJ,eAAO,MAAM,YAAY,GAAI,yDAM1B;IACD,EAAE,EAAE,QAAQ,CAAA;IACZ,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,mBAAmB,GAAG,sBAAsB,CAAA;IACvD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,sCAqCE,CAAA"}
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTOMATIC HASH-BASED SCHEMA MIGRATIONS
|
|
3
|
+
*
|
|
4
|
+
* This module implements automatic schema versioning using hash-based change detection.
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ CRITICAL DISTINCTION:
|
|
7
|
+
* - STATE TABLES (safe to modify): Changes trigger rematerialization from eventlog
|
|
8
|
+
* - EVENTLOG TABLES (NEVER modify): Changes cause data loss - need manual versioning!
|
|
9
|
+
*
|
|
10
|
+
* How it works:
|
|
11
|
+
* 1. Each table's schema is hashed using SqliteAst.hash()
|
|
12
|
+
* 2. Hashes are stored in SCHEMA_META_TABLE after successful migrations
|
|
13
|
+
* 3. On app start, current schema hashes are compared with stored hashes
|
|
14
|
+
* 4. Mismatches trigger migrations:
|
|
15
|
+
* - State tables: Recreated and repopulated from eventlog (safe, no data loss)
|
|
16
|
+
* - Eventlog tables: Uses 'create-if-not-exists' (UNSAFE - causes data loss!)
|
|
17
|
+
*
|
|
18
|
+
* State Table Changes (SAFE):
|
|
19
|
+
* - User-defined tables are rebuilt from eventlog
|
|
20
|
+
* - System tables (schemaMetaTable, etc.) are recreated
|
|
21
|
+
* - Data preserved through rematerializeFromEventlog()
|
|
22
|
+
*
|
|
23
|
+
* Eventlog Table Changes (UNSAFE):
|
|
24
|
+
* - eventlogMetaTable, syncStatusTable changes cause "soft reset"
|
|
25
|
+
* - Old table becomes inaccessible (but remains in DB)
|
|
26
|
+
* - No automatic migration - effectively data loss
|
|
27
|
+
* - TODO: Implement proper EVENTLOG_PERSISTENCE_FORMAT_VERSION system
|
|
28
|
+
*
|
|
29
|
+
* See system-tables/state-tables.ts and system-tables/eventlog-tables.ts for detailed documentation on each table type.
|
|
30
|
+
*/
|
|
1
31
|
import { memoizeByStringifyArgs } from '@livestore/utils';
|
|
2
32
|
import { Effect } from '@livestore/utils/effect';
|
|
3
33
|
import { makeColumnSpec } from "../schema/state/sqlite/column-spec.js";
|
|
4
34
|
import { SqliteAst } from "../schema/state/sqlite/db-schema/mod.js";
|
|
5
|
-
import { isStateSystemTable, SCHEMA_EVENT_DEFS_META_TABLE, SCHEMA_META_TABLE, schemaEventDefsMetaTable, stateSystemTables, } from "../schema/state/sqlite/system-tables.js";
|
|
35
|
+
import { isStateSystemTable, SCHEMA_EVENT_DEFS_META_TABLE, SCHEMA_META_TABLE, schemaEventDefsMetaTable, stateSystemTables, } from "../schema/state/sqlite/system-tables/state-tables.js";
|
|
6
36
|
import { sql } from "../util.js";
|
|
7
37
|
import { dbExecute, dbSelect } from "./common.js";
|
|
8
38
|
import { validateSchema } from "./validate-schema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/schema-management/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE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,CAAA;oBACS,iBAAiB;;KAEhC,EACG,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CACrC,CAAA;IACH,CAAC;AACH,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,gCAAgC,EAAE;IAChD,UAAU,EAAE;QACV,YAAY,EAAE,QAAQ,CAAC,IAAI;QAC3B,SAAS,EAAE,QAAQ,CAAC,IAAI;KACzB;CACF,CAAC,CACH,CAAA;AAEH,MAAM,yBAAyB,GAAG,CAAC,SAAiB,EAAE,KAAsB,EAAE,EAAE;IAC9E,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9C,OAAO,GAAG,CAAA,UAAU,SAAS,yBAAyB,KAAK,CAAC,IAAI,SAAS,SAAS,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;AAC9I,CAAC,CAAA"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
export declare const liveStoreVersion: "0.4.0-dev.
|
|
1
|
+
export declare const liveStoreVersion: "0.4.0-dev.13";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Whenever this version changes, LiveStore will start with fresh database files. Old database files are not deleted.
|
|
3
|
+
* CRITICAL: Increment this version whenever you modify client-side EVENTLOG table schemas.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Used to generate database file names (e.g., `eventlog@6.db`, `state@6.db`) across all client adapters.
|
|
6
|
+
*
|
|
7
|
+
* Bump required when:
|
|
8
|
+
* - Modifying eventlog system tables (eventlogMetaTable, syncStatusTable) in schema/state/sqlite/system-tables/eventlog-tables.ts
|
|
9
|
+
* - Changing columns, types, constraints, or indexes in eventlog tables
|
|
10
|
+
*
|
|
11
|
+
* Bump NOT required when:
|
|
12
|
+
* - Modifying STATE table schemas (auto-migrated via hash-based detection and rebuilt from eventlog)
|
|
13
|
+
* - Changing query patterns or client-side implementation details
|
|
14
|
+
*
|
|
15
|
+
* ⚠️ CRITICAL: Eventlog changes without bumping this version cause permanent data loss!
|
|
16
|
+
*
|
|
17
|
+
* Impact: Version changes trigger a "soft reset" - old data becomes inaccessible but remains on disk.
|
|
8
18
|
*/
|
|
9
19
|
export declare const liveStoreStorageFormatVersion = 6;
|
|
10
20
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAA;AAEvD
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAA;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,6BAA6B,IAAI,CAAA"}
|