@voltro/database 0.40.0 → 0.42.0
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 +171 -0
- package/dist/{frameworkLiveTables-BS6FuivX.js → frameworkLiveTables-XPFqj8n3.js} +247 -247
- package/dist/index.d.ts +162 -0
- package/dist/index.js +815 -657
- package/dist/sql.d.ts +44 -4
- package/dist/sql.js +854 -796
- package/package.json +2 -2
package/dist/sql.d.ts
CHANGED
|
@@ -22,6 +22,16 @@ declare interface AggregateColumn<TResult = number | Date | null> {
|
|
|
22
22
|
readonly _result?: TResult;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** One condition under which a failed DDL statement means "already done". */
|
|
26
|
+
export declare interface AlreadySatisfied {
|
|
27
|
+
/** Why this is safe to ignore. Read by a human, not by code. */
|
|
28
|
+
readonly why: string;
|
|
29
|
+
/** Driver errnos (mysql family). */
|
|
30
|
+
readonly errno?: ReadonlyArray<number>;
|
|
31
|
+
/** Substrings of the driver message (sqlite, which has no errno for these). */
|
|
32
|
+
readonly messageIncludes?: ReadonlyArray<string>;
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
declare interface AndPredicate {
|
|
26
36
|
readonly and: ReadonlyArray<Predicate>;
|
|
27
37
|
}
|
|
@@ -185,6 +195,19 @@ export declare interface ApplyPlanCtx {
|
|
|
185
195
|
* ignored); an applier-side re-plan would compare against a different set and
|
|
186
196
|
* report drift that isn't there. A caller that cannot re-plan cannot prove it
|
|
187
197
|
* applied anything.
|
|
198
|
+
*
|
|
199
|
+
* **USE THE `sql` THIS HANDS YOU.** It is the connection the apply ran on, and
|
|
200
|
+
* that is the point: the convergence proof has to observe the session that
|
|
201
|
+
* made the change. A re-plan that opens its OWN connection is asking a
|
|
202
|
+
* different session whether the DDL landed, and the answer is not guaranteed
|
|
203
|
+
* to be yes yet.
|
|
204
|
+
*
|
|
205
|
+
* Measured on turso, where a pooled connection serves a `PRAGMA table_info`
|
|
206
|
+
* from before the `ALTER`: the column was added, the apply succeeded, and the
|
|
207
|
+
* self-opened re-plan proposed the same `add-column` again — so `applyPlan`
|
|
208
|
+
* refused to record a fingerprint and told the operator their perfectly good
|
|
209
|
+
* migration was a framework bug. `voltro db apply` did exactly that for two
|
|
210
|
+
* releases while `voltro dev`'s boot diff, which uses this parameter, did not.
|
|
188
211
|
*/
|
|
189
212
|
readonly replan: (sql: SqlClient.SqlClient) => Effect.Effect<MigrationPlan, SqlError_2, SqlClient.SqlClient>;
|
|
190
213
|
}
|
|
@@ -1087,19 +1110,21 @@ declare interface EagerLoadSpec {
|
|
|
1087
1110
|
|
|
1088
1111
|
export declare const emitAddIndexMysql: (op: Extract<MigrationOperation, {
|
|
1089
1112
|
kind: "add-index";
|
|
1090
|
-
}>, declared: ReadonlyArray<TableLike
|
|
1113
|
+
}>, declared: ReadonlyArray<TableLike>, engine?: MysqlEngine) => string;
|
|
1091
1114
|
|
|
1092
1115
|
export declare const emitCreateTableMysql: (op: Extract<MigrationOperation, {
|
|
1093
1116
|
kind: "create-table";
|
|
1094
|
-
}
|
|
1117
|
+
}>, engine?: MysqlEngine) => ReadonlyArray<string>;
|
|
1095
1118
|
|
|
1096
1119
|
export declare const emitDropColumnDdl: (op: Extract<MigrationOperation, {
|
|
1097
1120
|
kind: "drop-column";
|
|
1098
|
-
}>, q: typeof quote
|
|
1121
|
+
}>, q: typeof quote,
|
|
1122
|
+
/** postgres + mssql accept the conditional form; sqlite does not. */
|
|
1123
|
+
conditional?: boolean) => string;
|
|
1099
1124
|
|
|
1100
1125
|
export declare const emitDropColumnDdlMysql: (op: Extract<MigrationOperation, {
|
|
1101
1126
|
kind: "drop-column";
|
|
1102
|
-
}
|
|
1127
|
+
}>, engine?: MysqlEngine) => string;
|
|
1103
1128
|
|
|
1104
1129
|
/**
|
|
1105
1130
|
* Bootstrap DDL for framework-managed tables — `CREATE TABLE IF NOT EXISTS`, and
|
|
@@ -1178,6 +1203,14 @@ cdcChannel?: string) => string;
|
|
|
1178
1203
|
|
|
1179
1204
|
declare type EmptyMerge = unknown;
|
|
1180
1205
|
|
|
1206
|
+
/**
|
|
1207
|
+
* MariaDB stamps itself into the version string — `11.8.8-MariaDB`,
|
|
1208
|
+
* `10.11.2-MariaDB-1:10.11.2+maria~ubu2204`. MySQL never does. The check is
|
|
1209
|
+
* deliberately on VERSION() rather than `@@version_comment`, which some builds
|
|
1210
|
+
* leave generic.
|
|
1211
|
+
*/
|
|
1212
|
+
export declare const engineFromVersion: (version: string) => MysqlEngine;
|
|
1213
|
+
|
|
1181
1214
|
/**
|
|
1182
1215
|
* `EXISTS (SELECT 1 FROM ... WHERE ...)` / `NOT EXISTS (...)`.
|
|
1183
1216
|
* Mirrors `SubqueryInPredicate` but doesn't bind to a specific
|
|
@@ -1453,6 +1486,8 @@ export declare interface IndexSnapshot {
|
|
|
1453
1486
|
|
|
1454
1487
|
export declare const introspectSchema: (sql: SqlClient.SqlClient) => Effect.Effect<SchemaSnapshot, SqlError_2>;
|
|
1455
1488
|
|
|
1489
|
+
export declare const isAlreadySatisfied: (err: unknown, rules: ReadonlyArray<AlreadySatisfied>) => boolean;
|
|
1490
|
+
|
|
1456
1491
|
/** Type-guard for the discovery walker. */
|
|
1457
1492
|
export declare const isFileMigration: (value: unknown) => value is FileMigration;
|
|
1458
1493
|
|
|
@@ -1743,6 +1778,9 @@ declare interface MixinIndex {
|
|
|
1743
1778
|
readonly kindOptions?: IndexKindOptions;
|
|
1744
1779
|
}
|
|
1745
1780
|
|
|
1781
|
+
/** Which engine a `mysql`-dialect connection is actually talking to. */
|
|
1782
|
+
export declare type MysqlEngine = 'mysql' | 'mariadb';
|
|
1783
|
+
|
|
1746
1784
|
/**
|
|
1747
1785
|
* How long a prefix a MySQL/MariaDB index key may take on this column.
|
|
1748
1786
|
*
|
|
@@ -2497,6 +2535,8 @@ export declare const renderColumnPg: (col: ColumnSnapshot) => string;
|
|
|
2497
2535
|
*/
|
|
2498
2536
|
export declare const resolveMigrationLockSchema: (scope?: MigrationLockScope) => string | undefined;
|
|
2499
2537
|
|
|
2538
|
+
export declare const resolveMysqlEngine: (sql: SqlClient.SqlClient) => Effect.Effect<MysqlEngine, SqlError_2>;
|
|
2539
|
+
|
|
2500
2540
|
declare type RetryDecision = 'retry' | 'noRetry';
|
|
2501
2541
|
|
|
2502
2542
|
/**
|