uql-orm 0.21.0 → 0.22.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/README.md +5 -4
- package/dist/bunSql/bunSqlCockroachDialect.d.ts +2 -2
- package/dist/bunSql/bunSqlCockroachDialect.js +4 -10
- package/dist/bunSql/bunSqlPostgresDialect.d.ts +2 -2
- package/dist/bunSql/bunSqlPostgresDialect.js +4 -10
- package/dist/cockroachdb/cockroachDialect.d.ts +20 -4
- package/dist/cockroachdb/cockroachDialect.js +33 -18
- package/dist/d1/d1Querier.d.ts +4 -3
- package/dist/d1/d1Querier.js +0 -3
- package/dist/d1/d1SqliteDialect.d.ts +7 -0
- package/dist/d1/d1SqliteDialect.js +9 -0
- package/dist/dialect/abstractDialect.d.ts +8 -3
- package/dist/dialect/abstractDialect.js +9 -4
- package/dist/dialect/abstractSqlDialect.d.ts +35 -7
- package/dist/dialect/abstractSqlDialect.js +76 -35
- package/dist/dialect/index.d.ts +1 -0
- package/dist/dialect/index.js +1 -0
- package/dist/dialect/indexSqlDialect.d.ts +57 -0
- package/dist/dialect/indexSqlDialect.js +101 -0
- package/dist/dialect/mysqlLikeSqlDialect.d.ts +16 -1
- package/dist/dialect/mysqlLikeSqlDialect.js +32 -1
- package/dist/dialect/pgLikeSqlDialect.d.ts +33 -15
- package/dist/dialect/pgLikeSqlDialect.js +90 -56
- package/dist/dialect/vectorCast.d.ts +21 -0
- package/dist/dialect/vectorCast.js +28 -0
- package/dist/dialect/vectorSqlDialect.d.ts +10 -3
- package/dist/dialect/vectorSqlDialect.js +19 -8
- package/dist/entity/decorator/index-decorator.d.ts +2 -9
- package/dist/entity/metadata/definition.d.ts +5 -4
- package/dist/entity/metadata/definition.js +4 -3
- package/dist/libsql/libsqlDialect.d.ts +12 -2
- package/dist/libsql/libsqlDialect.js +14 -2
- package/dist/libsql/libsqlQuerier.d.ts +9 -22
- package/dist/libsql/libsqlQuerier.js +9 -85
- package/dist/libsql/libsqlQuerierPool.d.ts +10 -8
- package/dist/libsql/libsqlQuerierPool.js +17 -15
- package/dist/maria/mariaDialect.d.ts +26 -4
- package/dist/maria/mariaDialect.js +54 -15
- package/dist/migrate/builder/migrationBuilder.d.ts +9 -29
- package/dist/migrate/builder/migrationBuilder.js +58 -76
- package/dist/migrate/builder/splitSqlStatements.d.ts +0 -2
- package/dist/migrate/builder/splitSqlStatements.js +0 -2
- package/dist/migrate/builder/tableBuilder.d.ts +12 -2
- package/dist/migrate/builder/tableBuilder.js +71 -119
- package/dist/migrate/builder/types.d.ts +30 -41
- package/dist/migrate/cli.d.ts +3 -2
- package/dist/migrate/cli.js +21 -48
- package/dist/migrate/codegen/entityCodeGenerator.d.ts +0 -4
- package/dist/migrate/codegen/entityCodeGenerator.js +5 -63
- package/dist/migrate/codegen/fieldOptionsSource.d.ts +10 -0
- package/dist/migrate/codegen/fieldOptionsSource.js +55 -0
- package/dist/migrate/codegen/index.d.ts +0 -2
- package/dist/migrate/codegen/index.js +0 -4
- package/dist/migrate/generator/indexNodeToSchema.d.ts +9 -0
- package/dist/migrate/generator/indexNodeToSchema.js +14 -0
- package/dist/migrate/generator/mongoCommand.d.ts +57 -0
- package/dist/migrate/generator/mongoCommand.js +26 -0
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts +9 -20
- package/dist/migrate/generator/mongoSchemaGenerator.js +40 -82
- package/dist/migrate/index.d.ts +0 -1
- package/dist/migrate/index.js +0 -1
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +25 -10
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +46 -32
- package/dist/migrate/introspection/baseSqlIntrospector.d.ts +0 -1
- package/dist/migrate/introspection/baseSqlIntrospector.js +3 -12
- package/dist/migrate/introspection/mongoIntrospector.js +2 -2
- package/dist/migrate/introspection/mysqlIntrospector.d.ts +5 -8
- package/dist/migrate/introspection/mysqlIntrospector.js +4 -10
- package/dist/migrate/introspection/postgresIntrospector.d.ts +5 -8
- package/dist/migrate/introspection/postgresIntrospector.js +4 -10
- package/dist/migrate/introspection/sqliteIntrospector.d.ts +6 -5
- package/dist/migrate/introspection/sqliteIntrospector.js +26 -18
- package/dist/migrate/migrator.d.ts +23 -3
- package/dist/migrate/migrator.js +57 -69
- package/dist/migrate/schemaGenerator.d.ts +26 -37
- package/dist/migrate/schemaGenerator.js +69 -174
- package/dist/migrate/schemaGeneratorAsync.d.ts +2 -2
- package/dist/migrate/schemaGeneratorAsync.js +3 -3
- package/dist/migrate/storage/databaseStorage.js +4 -4
- package/dist/mongo/mongoDialect.d.ts +2 -0
- package/dist/mongo/mongoDialect.js +14 -3
- package/dist/mysql/mysqlDialect.d.ts +8 -0
- package/dist/mysql/mysqlDialect.js +13 -0
- package/dist/schema/canonicalType.d.ts +14 -2
- package/dist/schema/canonicalType.js +41 -31
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/schemaASTBuilder.d.ts +8 -1
- package/dist/schema/schemaASTBuilder.js +56 -47
- package/dist/schema/types.d.ts +10 -37
- package/dist/sqlite/abstractSqliteQuerier.d.ts +39 -0
- package/dist/sqlite/abstractSqliteQuerier.js +44 -0
- package/dist/sqlite/bunSqliteAdapter.bun.d.ts +26 -0
- package/dist/sqlite/bunSqliteAdapter.bun.js +25 -0
- package/dist/sqlite/hranaQuerier.d.ts +54 -0
- package/dist/sqlite/hranaQuerier.js +90 -0
- package/dist/sqlite/hranaQuerierPool.d.ts +21 -0
- package/dist/sqlite/hranaQuerierPool.js +25 -0
- package/dist/sqlite/index.d.ts +2 -1
- package/dist/sqlite/index.js +2 -1
- package/dist/sqlite/sqliteDialect.d.ts +18 -4
- package/dist/sqlite/sqliteDialect.js +24 -24
- package/dist/sqlite/sqliteQuerier.d.ts +16 -9
- package/dist/sqlite/sqliteQuerier.js +4 -27
- package/dist/sqlite/sqliteQuerierPool.d.ts +14 -4
- package/dist/sqlite/sqliteQuerierPool.js +16 -5
- package/dist/turso/index.d.ts +3 -0
- package/dist/turso/index.js +3 -0
- package/dist/turso/local.d.ts +3 -0
- package/dist/turso/local.js +3 -0
- package/dist/turso/tursoDialect.d.ts +15 -0
- package/dist/turso/tursoDialect.js +18 -0
- package/dist/turso/tursoLocalQuerier.d.ts +25 -0
- package/dist/turso/tursoLocalQuerier.js +20 -0
- package/dist/turso/tursoLocalQuerierPool.d.ts +32 -0
- package/dist/turso/tursoLocalQuerierPool.js +39 -0
- package/dist/turso/tursoQuerier.d.ts +10 -0
- package/dist/turso/tursoQuerier.js +10 -0
- package/dist/turso/tursoQuerierPool.d.ts +39 -0
- package/dist/turso/tursoQuerierPool.js +38 -0
- package/dist/type/config.d.ts +0 -6
- package/dist/type/dialect.d.ts +12 -4
- package/dist/type/dialect.js +7 -1
- package/dist/type/entity.d.ts +66 -5
- package/dist/type/migration.d.ts +32 -23
- package/dist/type/vector.d.ts +5 -2
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +1 -0
- package/dist/util/indexColumn.util.d.ts +6 -0
- package/dist/util/indexColumn.util.js +26 -0
- package/package.json +16 -3
- package/dist/migrate/codegen/entityMerger.d.ts +0 -114
- package/dist/migrate/codegen/entityMerger.js +0 -293
- package/dist/migrate/codegen/migrationCodeGenerator.d.ts +0 -61
- package/dist/migrate/codegen/migrationCodeGenerator.js +0 -355
- package/dist/migrate/generator/index.d.ts +0 -2
- package/dist/migrate/generator/index.js +0 -2
- package/dist/migrate/sync/index.d.ts +0 -6
- package/dist/migrate/sync/index.js +0 -6
- package/dist/migrate/sync/schemaSync.d.ts +0 -131
- package/dist/migrate/sync/schemaSync.js +0 -259
- package/dist/sqlite/betterSqlite3Dialect.d.ts +0 -9
- package/dist/sqlite/betterSqlite3Dialect.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractDialect } from './abstractDialect.js';
|
|
2
|
-
import {
|
|
2
|
+
import { MULTI_VECTOR_TYPE_DIALECTS } from './vectorCast.js';
|
|
3
3
|
/**
|
|
4
4
|
* Vector similarity search for SQL dialects: the `ORDER BY <distance>` expression, its projection as
|
|
5
5
|
* a named score, and the index metadata the schema generator reads.
|
|
@@ -13,8 +13,6 @@ import { resolveVectorCast } from './vectorCast.js';
|
|
|
13
13
|
* {@link appendVectorSort} or filling {@link vectorDistanceFns}.
|
|
14
14
|
*/
|
|
15
15
|
export class VectorSqlDialect extends AbstractDialect {
|
|
16
|
-
/** Vector index operator classes, keyed by distance metric. Partial: not every dialect supports every metric. */
|
|
17
|
-
vectorOpsClass = undefined;
|
|
18
16
|
vectorExtension = undefined;
|
|
19
17
|
/**
|
|
20
18
|
* Mapping of UQL vector distance metrics to native SQL functions.
|
|
@@ -30,21 +28,34 @@ export class VectorSqlDialect extends AbstractDialect {
|
|
|
30
28
|
const field = meta.fields[key];
|
|
31
29
|
const colName = this.resolveColumnName(key, field);
|
|
32
30
|
const distance = search.$distance ?? field?.distance ?? 'cosine';
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return { colName, distance, field };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Binds a vector, both as a persisted value and as the query vector of a distance expression, so a
|
|
35
|
+
* dialect needing a conversion around it (`$1::vector`, `VEC_FromText(?)`) declares it once.
|
|
36
|
+
*/
|
|
37
|
+
appendVectorValue(ctx, value, _field) {
|
|
38
|
+
ctx.addValue(`[${value.join(',')}]`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The vector type this dialect actually has for a declared one, so the cast follows the column
|
|
42
|
+
* rather than naming a type the engine does not define. See {@link MULTI_VECTOR_TYPE_DIALECTS}.
|
|
43
|
+
*/
|
|
44
|
+
supportedVectorType(cast) {
|
|
45
|
+
return MULTI_VECTOR_TYPE_DIALECTS.has(this.dialectName) ? cast : 'vector';
|
|
35
46
|
}
|
|
36
47
|
/**
|
|
37
48
|
* Append a vector similarity function call: `fn(col, ?)`.
|
|
38
49
|
* Used by dialects that express vector distance via SQL functions (SQLite, MariaDB).
|
|
39
50
|
*/
|
|
40
51
|
appendFunctionVectorSort(ctx, meta, key, search) {
|
|
41
|
-
const { colName, distance } = this.resolveVectorSortParams(meta, key, search);
|
|
52
|
+
const { colName, distance, field } = this.resolveVectorSortParams(meta, key, search);
|
|
42
53
|
const fn = this.vectorDistanceFns.get(distance);
|
|
43
54
|
if (!fn) {
|
|
44
55
|
throw Error(`${this.dialectName} does not support vector distance metric: ${distance}`);
|
|
45
56
|
}
|
|
46
57
|
ctx.append(`${fn}(${this.escapeId(colName)}, `);
|
|
47
|
-
|
|
58
|
+
this.appendVectorValue(ctx, search.$vector, field);
|
|
48
59
|
ctx.append(')');
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
@@ -64,6 +75,6 @@ export class VectorSqlDialect extends AbstractDialect {
|
|
|
64
75
|
this.appendFunctionVectorSort(ctx, meta, key, search);
|
|
65
76
|
return;
|
|
66
77
|
}
|
|
67
|
-
throw new TypeError(
|
|
78
|
+
throw new TypeError(`${this.dialectName} does not support vector similarity sort. Use raw() for vector queries.`);
|
|
68
79
|
}
|
|
69
80
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
* Options for the @Index decorator - {@link EntityIndexMeta} minus `columns`, which the decorator
|
|
4
|
-
* takes as its own positional argument. `DistributiveOmit` (not plain `Omit`) keeps `type`/`distance`
|
|
5
|
-
* a discriminated pair - `EntityIndexMeta`'s vector-index invariant, that omitting `distance` on a
|
|
6
|
-
* vector index type is a compile error.
|
|
7
|
-
*/
|
|
8
|
-
export type IndexDecoratorOptions = DistributiveOmit<EntityIndexMeta, 'columns'>;
|
|
1
|
+
import type { IndexColumnInput, IndexOptions, Type } from '../../type/index.js';
|
|
9
2
|
/**
|
|
10
3
|
* Define a composite index on an entity class.
|
|
11
4
|
*
|
|
@@ -26,4 +19,4 @@ export type IndexDecoratorOptions = DistributiveOmit<EntityIndexMeta, 'columns'>
|
|
|
26
19
|
* export class User { ... }
|
|
27
20
|
* ```
|
|
28
21
|
*/
|
|
29
|
-
export declare function Index<E>(columns:
|
|
22
|
+
export declare function Index<E>(columns: readonly IndexColumnInput[], options?: IndexOptions): (target: Type<E>) => void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EntityIndexInput, EntityMeta, EntityOptions, FieldOptions, FilterOptions, HookEvent, RelationOptions, Type } from '../../type/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* Append a composite index entry with normalized `unique` (default false).
|
|
3
|
+
* Append a composite index entry with normalized `unique` (default false) and columns. Normalizing
|
|
4
|
+
* here is what lets the dialects render one shape instead of re-parsing the authored sugar.
|
|
4
5
|
*/
|
|
5
|
-
export declare function appendEntityIndex<E>(meta: EntityMeta<E>, index:
|
|
6
|
+
export declare function appendEntityIndex<E>(meta: EntityMeta<E>, index: EntityIndexInput): void;
|
|
6
7
|
export declare function defineField<E>(entity: Type<E>, key: string, opts?: FieldOptions): EntityMeta<E>;
|
|
7
8
|
export declare function defineId<E>(entity: Type<E>, key: string, opts: FieldOptions): EntityMeta<E>;
|
|
8
9
|
export declare function defineRelation<E>(entity: Type<E>, key: string, opts: RelationOptions<E>): EntityMeta<E>;
|
|
9
10
|
export declare function defineHook<E>(entity: Type<E>, methodName: string, event: HookEvent): EntityMeta<E>;
|
|
10
|
-
export declare function defineIndex<E>(entity: Type<E>, index:
|
|
11
|
+
export declare function defineIndex<E>(entity: Type<E>, index: EntityIndexInput): EntityMeta<E>;
|
|
11
12
|
export declare function defineFilter<E>(entity: Type<E>, name: string, opts: FilterOptions<E>): EntityMeta<E>;
|
|
12
13
|
export declare function defineEntity<E>(entity: Type<E>, opts?: EntityOptions<E>): EntityMeta<E>;
|
|
13
14
|
export declare function getEntities(): Type<unknown>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getKeys, hasKeys, lowerFirst, upperFirst } from '../../util/index.js';
|
|
1
|
+
import { getKeys, hasKeys, lowerFirst, normalizeIndexColumn, upperFirst } from '../../util/index.js';
|
|
2
2
|
import { LoggerWrapper } from '../../util/logger.js';
|
|
3
3
|
// Held on `globalThis` via the global symbol registry so a single metadata map survives multiple
|
|
4
4
|
// evaluations of this module (HMR, duplicated/federated bundles, ESM+CJS dual-loading).
|
|
@@ -8,12 +8,13 @@ const metas = holder[metaKey] ?? new Map();
|
|
|
8
8
|
holder[metaKey] = metas;
|
|
9
9
|
const registrationLogger = new LoggerWrapper(true);
|
|
10
10
|
/**
|
|
11
|
-
* Append a composite index entry with normalized `unique` (default false).
|
|
11
|
+
* Append a composite index entry with normalized `unique` (default false) and columns. Normalizing
|
|
12
|
+
* here is what lets the dialects render one shape instead of re-parsing the authored sugar.
|
|
12
13
|
*/
|
|
13
14
|
export function appendEntityIndex(meta, index) {
|
|
14
15
|
if (!meta.indexes)
|
|
15
16
|
meta.indexes = [];
|
|
16
|
-
meta.indexes.push({ ...index, unique: index.unique ?? false });
|
|
17
|
+
meta.indexes.push({ ...index, unique: index.unique ?? false, columns: index.columns.map(normalizeIndexColumn) });
|
|
17
18
|
}
|
|
18
19
|
export function defineField(entity, key, opts = {}) {
|
|
19
20
|
const meta = ensureMeta(entity);
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { SqliteDialect } from '../sqlite/sqliteDialect.js';
|
|
2
|
+
import type { VectorDistance } from '../type/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* SQLite Dialect specialization for the `@libsql/client` driver.
|
|
4
5
|
*
|
|
5
|
-
* @remarks
|
|
6
|
-
*
|
|
6
|
+
* @remarks Distinct type for `LibsqlQuerierPool` and the home of the libSQL engine's built-in vector
|
|
7
|
+
* functions, which `TursoDialect` inherits.
|
|
7
8
|
*/
|
|
8
9
|
export declare class LibsqlDialect extends SqliteDialect {
|
|
10
|
+
/**
|
|
11
|
+
* libSQL has vector search built in, under its own names, so the sqlite-vec `vec_distance_*`
|
|
12
|
+
* functions this dialect would otherwise inherit are never present.
|
|
13
|
+
*
|
|
14
|
+
* @remarks `inner` and `l1` are left out: `vector_distance_dot` only exists in the newer Rust
|
|
15
|
+
* engine (see `TursoDialect`) and no libSQL build has an L1 metric. Both raise the same
|
|
16
|
+
* "does not support vector distance metric" error as any other unsupported metric.
|
|
17
|
+
*/
|
|
18
|
+
protected readonly vectorDistanceFns: ReadonlyMap<VectorDistance, string>;
|
|
9
19
|
}
|
|
@@ -2,8 +2,20 @@ import { SqliteDialect } from '../sqlite/sqliteDialect.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* SQLite Dialect specialization for the `@libsql/client` driver.
|
|
4
4
|
*
|
|
5
|
-
* @remarks
|
|
6
|
-
*
|
|
5
|
+
* @remarks Distinct type for `LibsqlQuerierPool` and the home of the libSQL engine's built-in vector
|
|
6
|
+
* functions, which `TursoDialect` inherits.
|
|
7
7
|
*/
|
|
8
8
|
export class LibsqlDialect extends SqliteDialect {
|
|
9
|
+
/**
|
|
10
|
+
* libSQL has vector search built in, under its own names, so the sqlite-vec `vec_distance_*`
|
|
11
|
+
* functions this dialect would otherwise inherit are never present.
|
|
12
|
+
*
|
|
13
|
+
* @remarks `inner` and `l1` are left out: `vector_distance_dot` only exists in the newer Rust
|
|
14
|
+
* engine (see `TursoDialect`) and no libSQL build has an L1 metric. Both raise the same
|
|
15
|
+
* "does not support vector distance metric" error as any other unsupported metric.
|
|
16
|
+
*/
|
|
17
|
+
vectorDistanceFns = new Map([
|
|
18
|
+
['cosine', 'vector_distance_cos'],
|
|
19
|
+
['l2', 'vector_distance_l2'],
|
|
20
|
+
]);
|
|
9
21
|
}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare class LibsqlQuerier extends AbstractSqliteQuerier {
|
|
11
|
-
readonly client: Client;
|
|
12
|
-
readonly extra?: ExtraOptions | undefined;
|
|
13
|
-
private tx?;
|
|
14
|
-
private readonly closeClientOnRelease;
|
|
15
|
-
constructor(client: Client, dialect: SqliteDialect, extra?: ExtraOptions | undefined, connection?: LibsqlQuerierConnectionOptions);
|
|
16
|
-
internalAll<T>(query: string, values?: unknown[]): Promise<T[]>;
|
|
17
|
-
internalRun(query: string, values?: unknown[]): Promise<import("../type/query.js").QueryUpdateResult>;
|
|
18
|
-
get hasOpenTransaction(): boolean;
|
|
19
|
-
beginTransaction(_opts?: TransactionOptions): Promise<void>;
|
|
20
|
-
commitTransaction(): Promise<void>;
|
|
21
|
-
rollbackTransaction(): Promise<void>;
|
|
22
|
-
internalRelease(): Promise<void>;
|
|
1
|
+
import { HranaQuerier } from '../sqlite/hranaQuerier.js';
|
|
2
|
+
/**
|
|
3
|
+
* Querier for the `@libsql/client` driver.
|
|
4
|
+
*
|
|
5
|
+
* @remarks Empty subclass by design: that client speaks the Hrana protocol, so the whole
|
|
6
|
+
* implementation is inherited. Kept as a distinct type for `LibsqlQuerierPool` and as a hook for
|
|
7
|
+
* future libsql-specific behavior.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LibsqlQuerier extends HranaQuerier {
|
|
23
10
|
}
|
|
@@ -1,86 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { Serialized } from '../querier/decorator/index.js';
|
|
11
|
-
import { AbstractSqliteQuerier } from '../sqlite/abstractSqliteQuerier.js';
|
|
12
|
-
import { throwNoPendingTransaction, throwPendingTransaction } from '../util/index.js';
|
|
13
|
-
export class LibsqlQuerier extends AbstractSqliteQuerier {
|
|
14
|
-
client;
|
|
15
|
-
extra;
|
|
16
|
-
tx;
|
|
17
|
-
closeClientOnRelease;
|
|
18
|
-
constructor(client, dialect, extra, connection) {
|
|
19
|
-
super(dialect, extra);
|
|
20
|
-
this.client = client;
|
|
21
|
-
this.extra = extra;
|
|
22
|
-
this.closeClientOnRelease = connection?.closeClientOnRelease ?? false;
|
|
23
|
-
}
|
|
24
|
-
async internalAll(query, values) {
|
|
25
|
-
const target = this.tx || this.client;
|
|
26
|
-
const res = await target.execute({ sql: query, args: values });
|
|
27
|
-
return res.rows;
|
|
28
|
-
}
|
|
29
|
-
async internalRun(query, values) {
|
|
30
|
-
const target = this.tx || this.client;
|
|
31
|
-
const res = await target.execute({ sql: query, args: values });
|
|
32
|
-
const rows = res.rows;
|
|
33
|
-
// `rowsAffected` is unreliably 0 whenever the statement has a RETURNING clause, so prefer
|
|
34
|
-
// the actual row count when rows were returned.
|
|
35
|
-
return this.buildUpdateResult({ rows, changes: rows.length || res.rowsAffected, id: res.lastInsertRowid });
|
|
36
|
-
}
|
|
37
|
-
get hasOpenTransaction() {
|
|
38
|
-
return !!this.tx;
|
|
39
|
-
}
|
|
40
|
-
async beginTransaction(_opts) {
|
|
41
|
-
if (this.tx) {
|
|
42
|
-
throwPendingTransaction();
|
|
43
|
-
}
|
|
44
|
-
this.tx = await this.client.transaction('write');
|
|
45
|
-
}
|
|
46
|
-
async commitTransaction() {
|
|
47
|
-
if (!this.tx) {
|
|
48
|
-
throwNoPendingTransaction();
|
|
49
|
-
}
|
|
50
|
-
await this.tx.commit();
|
|
51
|
-
this.tx = undefined;
|
|
52
|
-
}
|
|
53
|
-
async rollbackTransaction() {
|
|
54
|
-
if (!this.tx) {
|
|
55
|
-
throwNoPendingTransaction();
|
|
56
|
-
}
|
|
57
|
-
await this.tx.rollback();
|
|
58
|
-
this.tx = undefined;
|
|
59
|
-
}
|
|
60
|
-
async internalRelease() {
|
|
61
|
-
if (this.tx) {
|
|
62
|
-
throwPendingTransaction();
|
|
63
|
-
}
|
|
64
|
-
if (this.closeClientOnRelease) {
|
|
65
|
-
this.client.close();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
import { HranaQuerier } from '../sqlite/hranaQuerier.js';
|
|
2
|
+
/**
|
|
3
|
+
* Querier for the `@libsql/client` driver.
|
|
4
|
+
*
|
|
5
|
+
* @remarks Empty subclass by design: that client speaks the Hrana protocol, so the whole
|
|
6
|
+
* implementation is inherited. Kept as a distinct type for `LibsqlQuerierPool` and as a hook for
|
|
7
|
+
* future libsql-specific behavior.
|
|
8
|
+
*/
|
|
9
|
+
export class LibsqlQuerier extends HranaQuerier {
|
|
68
10
|
}
|
|
69
|
-
__decorate([
|
|
70
|
-
Serialized(),
|
|
71
|
-
__metadata("design:type", Function),
|
|
72
|
-
__metadata("design:paramtypes", [Object]),
|
|
73
|
-
__metadata("design:returntype", Promise)
|
|
74
|
-
], LibsqlQuerier.prototype, "beginTransaction", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
Serialized(),
|
|
77
|
-
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", []),
|
|
79
|
-
__metadata("design:returntype", Promise)
|
|
80
|
-
], LibsqlQuerier.prototype, "commitTransaction", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
Serialized(),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", []),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], LibsqlQuerier.prototype, "rollbackTransaction", null);
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { Config } from '@libsql/client';
|
|
2
|
+
import type { HranaClient, HranaQuerierConnectionOptions } from '../sqlite/hranaQuerier.js';
|
|
3
|
+
import { AbstractHranaQuerierPool } from '../sqlite/hranaQuerierPool.js';
|
|
3
4
|
import type { ExtraOptions } from '../type/index.js';
|
|
4
5
|
import { LibsqlDialect } from './libsqlDialect.js';
|
|
5
6
|
import { LibsqlQuerier } from './libsqlQuerier.js';
|
|
6
7
|
/** Embedded replica: local `file:` DB + `syncUrl` remote - DDL should run on the remote (sqld). */
|
|
7
8
|
export declare function libsqlUseRemoteForMigrations(config: Pick<Config, 'url' | 'syncUrl'>): boolean;
|
|
8
|
-
export declare class LibsqlQuerierPool extends
|
|
9
|
-
readonly
|
|
10
|
-
private readonly libsqlConfig;
|
|
9
|
+
export declare class LibsqlQuerierPool extends AbstractHranaQuerierPool<LibsqlQuerier, LibsqlDialect> {
|
|
10
|
+
private readonly conf;
|
|
11
11
|
constructor(conf: Config, extra?: ExtraOptions);
|
|
12
|
-
|
|
12
|
+
protected openClient(): Promise<HranaClient>;
|
|
13
|
+
protected buildQuerier(client: HranaClient, connection?: HranaQuerierConnectionOptions): LibsqlQuerier;
|
|
13
14
|
/**
|
|
14
15
|
* For embedded replicas (`file:` + `syncUrl`), returns a querier connected to `syncUrl` so migrations hit sqld.
|
|
15
|
-
* Otherwise same as
|
|
16
|
+
* Otherwise same as `getQuerier`. The migrator calls this for `up`/`down`, `syncForce`, and `autoSync` DDL.
|
|
16
17
|
*/
|
|
17
18
|
getMigrationQuerier(): Promise<LibsqlQuerier>;
|
|
18
|
-
|
|
19
|
+
/** Imported on use, so `uql-orm/libsql` loads without the optional `@libsql/client` peer installed. */
|
|
20
|
+
private createClient;
|
|
19
21
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbstractSqlQuerierPool } from '../querier/index.js';
|
|
1
|
+
import { AbstractHranaQuerierPool } from '../sqlite/hranaQuerierPool.js';
|
|
3
2
|
import { LibsqlDialect } from './libsqlDialect.js';
|
|
4
3
|
import { LibsqlQuerier } from './libsqlQuerier.js';
|
|
5
4
|
/** Embedded replica: local `file:` DB + `syncUrl` remote - DDL should run on the remote (sqld). */
|
|
@@ -11,29 +10,32 @@ function remoteMigrationClientConfig(config) {
|
|
|
11
10
|
const { syncUrl, url: _localUrl, ...rest } = config;
|
|
12
11
|
return { ...rest, url: syncUrl };
|
|
13
12
|
}
|
|
14
|
-
export class LibsqlQuerierPool extends
|
|
15
|
-
|
|
16
|
-
libsqlConfig;
|
|
13
|
+
export class LibsqlQuerierPool extends AbstractHranaQuerierPool {
|
|
14
|
+
conf;
|
|
17
15
|
constructor(conf, extra) {
|
|
18
16
|
super(new LibsqlDialect({ namingStrategy: extra?.namingStrategy }), extra);
|
|
19
|
-
this.
|
|
20
|
-
this.client = createClient(conf);
|
|
17
|
+
this.conf = conf;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
return
|
|
19
|
+
openClient() {
|
|
20
|
+
return this.createClient(this.conf);
|
|
21
|
+
}
|
|
22
|
+
buildQuerier(client, connection) {
|
|
23
|
+
return new LibsqlQuerier(client, this.dialect, this.extra, connection);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* For embedded replicas (`file:` + `syncUrl`), returns a querier connected to `syncUrl` so migrations hit sqld.
|
|
27
|
-
* Otherwise same as
|
|
27
|
+
* Otherwise same as `getQuerier`. The migrator calls this for `up`/`down`, `syncForce`, and `autoSync` DDL.
|
|
28
28
|
*/
|
|
29
29
|
async getMigrationQuerier() {
|
|
30
|
-
if (!libsqlUseRemoteForMigrations(this.
|
|
30
|
+
if (!libsqlUseRemoteForMigrations(this.conf)) {
|
|
31
31
|
return this.getQuerier();
|
|
32
32
|
}
|
|
33
|
-
const remote = createClient(remoteMigrationClientConfig(this.
|
|
34
|
-
return
|
|
33
|
+
const remote = await this.createClient(remoteMigrationClientConfig(this.conf));
|
|
34
|
+
return this.buildQuerier(remote, { closeClientOnRelease: true });
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/** Imported on use, so `uql-orm/libsql` loads without the optional `@libsql/client` peer installed. */
|
|
37
|
+
async createClient(conf) {
|
|
38
|
+
const { createClient } = await import('@libsql/client');
|
|
39
|
+
return createClient(conf);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type { DialectOptions } from '../dialect/abstractDialect.js';
|
|
2
1
|
import { MysqlLikeSqlDialect } from '../dialect/mysqlLikeSqlDialect.js';
|
|
3
|
-
import type { QueryConflictPaths, QueryContext,
|
|
2
|
+
import type { DialectFeatures, FieldOptions, IndexFeature, IndexSchema, QueryConflictPaths, QueryContext, Type, VectorDistance } from '../type/index.js';
|
|
4
3
|
export declare class MariaDialect extends MysqlLikeSqlDialect {
|
|
5
4
|
readonly dialectName = "mariadb";
|
|
6
5
|
readonly insertIdSource = "returning";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* MariaDB has no functional indexes: `CREATE INDEX ... ((lower(col)))` is a syntax error even on
|
|
8
|
+
* 12.3, where the documented workaround is a generated column. So it keeps the prefix lengths the
|
|
9
|
+
* family shares and drops expressions.
|
|
10
|
+
*/
|
|
11
|
+
protected readonly indexFeatures: Set<IndexFeature>;
|
|
12
|
+
/** Unlike MySQL: `VECTOR(n)` takes its dimension, and its vector index is declared inline. */
|
|
13
|
+
protected readonly featureOverrides: Partial<DialectFeatures>;
|
|
9
14
|
upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[]): void;
|
|
10
15
|
/**
|
|
11
16
|
* MariaDB supports neither MySQL's `->`/`->>` shorthand nor the base's chained form. `JSON_VALUE`
|
|
@@ -22,6 +27,23 @@ export declare class MariaDialect extends MysqlLikeSqlDialect {
|
|
|
22
27
|
protected jsonPullElem(alias: string): string;
|
|
23
28
|
/** Text-backed JSON compares as text, so use JSON_EQUALS for key-order-independent equality. */
|
|
24
29
|
protected jsonPullKeep(alias: string, operand: string): string;
|
|
30
|
+
/** MariaDB's own names for the metrics its vector index accepts. */
|
|
31
|
+
private static readonly INLINE_VECTOR_METRICS;
|
|
25
32
|
/** MariaDB 11.7+ vector distance functions. */
|
|
26
33
|
protected readonly vectorDistanceFns: ReadonlyMap<VectorDistance, string>;
|
|
34
|
+
/**
|
|
35
|
+
* A `VECTOR` column holds a packed little-endian float32 blob, and MariaDB refuses text where one
|
|
36
|
+
* belongs: inserting `'[1,2,3]'` fails with `Incorrect vector value`, and passing it to
|
|
37
|
+
* `VEC_DISTANCE_COSINE` with `Illegal parameter data type varchar`. `VEC_FromText` is the
|
|
38
|
+
* conversion, needed on both paths.
|
|
39
|
+
*/
|
|
40
|
+
protected appendVectorValue(ctx: QueryContext, value: readonly unknown[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* MariaDB declares a vector index inside `CREATE TABLE`: `VECTOR INDEX (col) M=n DISTANCE=metric`.
|
|
43
|
+
* Its metric names are its own (`euclidean`, not `l2`), and an unsupported one throws rather than
|
|
44
|
+
* being dropped, which would silently build the index on cosine instead.
|
|
45
|
+
*/
|
|
46
|
+
getInlineVectorIndexDeclaration(index: IndexSchema): string;
|
|
47
|
+
/** The reverse: selecting a `VECTOR` column raw yields that blob, so it is read back as text. */
|
|
48
|
+
protected selectFieldExpr(escapedColumn: string, field: FieldOptions): string;
|
|
27
49
|
}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
import { jsonPath } from '../dialect/jsonSql.js';
|
|
2
2
|
import { MysqlLikeSqlDialect } from '../dialect/mysqlLikeSqlDialect.js';
|
|
3
|
+
import { isVectorFieldType } from '../dialect/vectorCast.js';
|
|
3
4
|
import { getMeta } from '../entity/index.js';
|
|
4
5
|
export class MariaDialect extends MysqlLikeSqlDialect {
|
|
5
6
|
dialectName = 'mariadb';
|
|
6
7
|
// MariaDB 10.5+ supports `INSERT ... RETURNING` (see `insert` below), so IDs are exact per row.
|
|
7
8
|
insertIdSource = 'returning';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ctx.append(' ' + this.returningId(entity));
|
|
20
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* MariaDB has no functional indexes: `CREATE INDEX ... ((lower(col)))` is a syntax error even on
|
|
11
|
+
* 12.3, where the documented workaround is a generated column. So it keeps the prefix lengths the
|
|
12
|
+
* family shares and drops expressions.
|
|
13
|
+
*/
|
|
14
|
+
indexFeatures = new Set(['prefixLength']);
|
|
15
|
+
/** Unlike MySQL: `VECTOR(n)` takes its dimension, and its vector index is declared inline. */
|
|
16
|
+
featureOverrides = {
|
|
17
|
+
vectorSupportsLength: true,
|
|
18
|
+
inlineVectorIndex: true,
|
|
19
|
+
};
|
|
21
20
|
upsert(ctx, entity, conflictPaths, payload) {
|
|
22
21
|
const meta = getMeta(entity);
|
|
23
22
|
const updateCtx = this.createContext();
|
|
24
23
|
const update = this.getUpsertUpdateAssignments(updateCtx, meta, conflictPaths, payload, (name) => `VALUES(${name})`);
|
|
25
24
|
const returning = this.returningId(entity);
|
|
26
25
|
if (update) {
|
|
27
|
-
|
|
26
|
+
this.appendInsertValues(ctx, entity, payload);
|
|
28
27
|
ctx.append(` ON DUPLICATE KEY UPDATE ${update} ${returning}`);
|
|
29
28
|
ctx.pushValue(...updateCtx.values);
|
|
30
29
|
}
|
|
31
30
|
else {
|
|
32
31
|
const insertCtx = this.createContext();
|
|
33
|
-
|
|
32
|
+
this.appendInsertValues(insertCtx, entity, payload);
|
|
34
33
|
ctx.append(insertCtx.sql.replace(/^INSERT/, 'INSERT IGNORE'));
|
|
35
34
|
ctx.append(' ' + returning);
|
|
36
35
|
ctx.pushValue(...insertCtx.values);
|
|
@@ -61,9 +60,49 @@ export class MariaDialect extends MysqlLikeSqlDialect {
|
|
|
61
60
|
jsonPullKeep(alias, operand) {
|
|
62
61
|
return `NOT JSON_EQUALS(${alias}.v, ${operand})`;
|
|
63
62
|
}
|
|
63
|
+
/** MariaDB's own names for the metrics its vector index accepts. */
|
|
64
|
+
static INLINE_VECTOR_METRICS = new Map([
|
|
65
|
+
['cosine', 'cosine'],
|
|
66
|
+
['l2', 'euclidean'],
|
|
67
|
+
]);
|
|
64
68
|
/** MariaDB 11.7+ vector distance functions. */
|
|
65
69
|
vectorDistanceFns = new Map([
|
|
66
70
|
['cosine', 'VEC_DISTANCE_COSINE'],
|
|
67
71
|
['l2', 'VEC_DISTANCE_EUCLIDEAN'],
|
|
68
72
|
]);
|
|
73
|
+
/**
|
|
74
|
+
* A `VECTOR` column holds a packed little-endian float32 blob, and MariaDB refuses text where one
|
|
75
|
+
* belongs: inserting `'[1,2,3]'` fails with `Incorrect vector value`, and passing it to
|
|
76
|
+
* `VEC_DISTANCE_COSINE` with `Illegal parameter data type varchar`. `VEC_FromText` is the
|
|
77
|
+
* conversion, needed on both paths.
|
|
78
|
+
*/
|
|
79
|
+
appendVectorValue(ctx, value) {
|
|
80
|
+
ctx.append('VEC_FromText(');
|
|
81
|
+
super.appendVectorValue(ctx, value);
|
|
82
|
+
ctx.append(')');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* MariaDB declares a vector index inside `CREATE TABLE`: `VECTOR INDEX (col) M=n DISTANCE=metric`.
|
|
86
|
+
* Its metric names are its own (`euclidean`, not `l2`), and an unsupported one throws rather than
|
|
87
|
+
* being dropped, which would silently build the index on cosine instead.
|
|
88
|
+
*/
|
|
89
|
+
getInlineVectorIndexDeclaration(index) {
|
|
90
|
+
const columns = index.columns.map((entry) => this.indexColumnTarget(entry)).join(', ');
|
|
91
|
+
let clause = `VECTOR INDEX (${columns})`;
|
|
92
|
+
if (index.m !== undefined) {
|
|
93
|
+
clause += ` M=${index.m}`;
|
|
94
|
+
}
|
|
95
|
+
if (index.distance) {
|
|
96
|
+
const metric = MariaDialect.INLINE_VECTOR_METRICS.get(index.distance);
|
|
97
|
+
if (!metric) {
|
|
98
|
+
throw new TypeError(`${this.dialectName} does not support vector distance metric: ${index.distance} (index "${index.name}")`);
|
|
99
|
+
}
|
|
100
|
+
clause += ` DISTANCE=${metric}`;
|
|
101
|
+
}
|
|
102
|
+
return clause;
|
|
103
|
+
}
|
|
104
|
+
/** The reverse: selecting a `VECTOR` column raw yields that blob, so it is read back as text. */
|
|
105
|
+
selectFieldExpr(escapedColumn, field) {
|
|
106
|
+
return isVectorFieldType(field.type) ? `VEC_ToText(${escapedColumn})` : escapedColumn;
|
|
107
|
+
}
|
|
69
108
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* - MigrationBuilder: Execute DDL operations (for integration tests/runtime)
|
|
7
7
|
*/
|
|
8
8
|
import type { ForeignKeyAction } from '../../schema/types.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { IndexColumnInput, IndexOptions } from '../../type/index.js';
|
|
10
10
|
import type { SqlQuerier } from '../../type/querier.js';
|
|
11
|
-
import type { AnyMigrationOperation, IAlterTableBuilder, IColumnBuilder, IMigrationBuilder, ITableBuilder } from './types.js';
|
|
11
|
+
import type { AnyMigrationOperation, IAlterTableBuilder, IColumnBuilder, IColumnFactory, IMigrationBuilder, ITableBuilder } from './types.js';
|
|
12
12
|
/**
|
|
13
13
|
* Records migration operations without executing them.
|
|
14
14
|
* Use for migration code generation and dry-run scenarios.
|
|
@@ -22,15 +22,11 @@ export declare class OperationRecorder implements IMigrationBuilder {
|
|
|
22
22
|
}): Promise<void>;
|
|
23
23
|
renameTable(oldName: string, newName: string): Promise<void>;
|
|
24
24
|
alterTable(name: string, callback: (table: IAlterTableBuilder) => void): Promise<void>;
|
|
25
|
-
addColumn(tableName: string,
|
|
25
|
+
addColumn(tableName: string, callback: (columns: IColumnFactory) => IColumnBuilder): Promise<void>;
|
|
26
26
|
dropColumn(tableName: string, columnName: string): Promise<void>;
|
|
27
|
-
alterColumn(tableName: string,
|
|
27
|
+
alterColumn(tableName: string, callback: (columns: IColumnFactory) => IColumnBuilder): Promise<void>;
|
|
28
28
|
renameColumn(tableName: string, oldName: string, newName: string): Promise<void>;
|
|
29
|
-
createIndex(tableName: string, columns:
|
|
30
|
-
name?: string;
|
|
31
|
-
unique?: boolean;
|
|
32
|
-
where?: string;
|
|
33
|
-
}): Promise<void>;
|
|
29
|
+
createIndex(tableName: string, columns: readonly IndexColumnInput[], options?: IndexOptions): Promise<void>;
|
|
34
30
|
dropIndex(tableName: string, indexName: string): Promise<void>;
|
|
35
31
|
addForeignKey(tableName: string, columns: string[], target: {
|
|
36
32
|
table: string;
|
|
@@ -45,13 +41,6 @@ export declare class OperationRecorder implements IMigrationBuilder {
|
|
|
45
41
|
getOperations(): AnyMigrationOperation[];
|
|
46
42
|
recordOperationSync(operation: AnyMigrationOperation): void;
|
|
47
43
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Options for the migration builder.
|
|
50
|
-
*/
|
|
51
|
-
export interface MigrationBuilderOptions {
|
|
52
|
-
/** Custom naming strategy for generated SQL */
|
|
53
|
-
namingStrategy?: NamingStrategy;
|
|
54
|
-
}
|
|
55
44
|
/**
|
|
56
45
|
* Executes DDL operations via a SQL querier.
|
|
57
46
|
* Use for integration tests and runtime schema management.
|
|
@@ -70,7 +59,7 @@ export interface MigrationBuilderOptions {
|
|
|
70
59
|
export declare class MigrationBuilder extends OperationRecorder {
|
|
71
60
|
private readonly querier;
|
|
72
61
|
private readonly sqlGenerator;
|
|
73
|
-
constructor(querier: SqlQuerier
|
|
62
|
+
constructor(querier: SqlQuerier);
|
|
74
63
|
recordOperationSync(operation: AnyMigrationOperation): void;
|
|
75
64
|
raw(sql: string): Promise<void>;
|
|
76
65
|
createTable(name: string, callback: (table: ITableBuilder) => void): Promise<void>;
|
|
@@ -79,15 +68,11 @@ export declare class MigrationBuilder extends OperationRecorder {
|
|
|
79
68
|
cascade?: boolean;
|
|
80
69
|
}): Promise<void>;
|
|
81
70
|
renameTable(oldName: string, newName: string): Promise<void>;
|
|
82
|
-
addColumn(tableName: string,
|
|
71
|
+
addColumn(tableName: string, callback: (columns: IColumnFactory) => IColumnBuilder): Promise<void>;
|
|
83
72
|
dropColumn(tableName: string, columnName: string): Promise<void>;
|
|
84
|
-
alterColumn(tableName: string,
|
|
73
|
+
alterColumn(tableName: string, callback: (columns: IColumnFactory) => IColumnBuilder): Promise<void>;
|
|
85
74
|
renameColumn(tableName: string, oldName: string, newName: string): Promise<void>;
|
|
86
|
-
createIndex(tableName: string, columns:
|
|
87
|
-
name?: string;
|
|
88
|
-
unique?: boolean;
|
|
89
|
-
where?: string;
|
|
90
|
-
}): Promise<void>;
|
|
75
|
+
createIndex(tableName: string, columns: readonly IndexColumnInput[], options?: IndexOptions): Promise<void>;
|
|
91
76
|
dropIndex(tableName: string, indexName: string): Promise<void>;
|
|
92
77
|
addForeignKey(tableName: string, columns: string[], target: {
|
|
93
78
|
table: string;
|
|
@@ -102,8 +87,3 @@ export declare class MigrationBuilder extends OperationRecorder {
|
|
|
102
87
|
private execute;
|
|
103
88
|
private operationToSql;
|
|
104
89
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Create an operation recorder for dry-run (recording only).
|
|
107
|
-
* @deprecated Use `new OperationRecorder()` directly
|
|
108
|
-
*/
|
|
109
|
-
export declare function createDryRunBuilder(): OperationRecorder;
|