uql-orm 0.66.0 → 0.67.1
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/browser/querier/httpQuerier.js +1 -8
- package/dist/browser/uql-browser.min.js.map +5 -5
- package/dist/bunSql/bunSql.util.d.ts +2 -6
- package/dist/bunSql/bunSql.util.js +2 -6
- package/dist/bunSql/bunSqlQuerier.d.ts +2 -5
- package/dist/bunSql/bunSqlQuerier.js +2 -5
- package/dist/cockroachdb/cockroachDialect.d.ts +4 -13
- package/dist/cockroachdb/cockroachDialect.js +4 -13
- package/dist/context/context.browser.js +2 -10
- package/dist/context/context.d.ts +4 -17
- package/dist/context/context.js +4 -17
- package/dist/dialect/abstractDialect.d.ts +4 -19
- package/dist/dialect/abstractDialect.js +2 -20
- package/dist/dialect/abstractSqlDialect.d.ts +47 -212
- package/dist/dialect/abstractSqlDialect.js +68 -222
- package/dist/dialect/aliases.d.ts +2 -12
- package/dist/dialect/aliases.js +4 -12
- package/dist/dialect/hydrateColumn.d.ts +2 -6
- package/dist/dialect/hydrateColumn.js +3 -13
- package/dist/dialect/jsonArrayElemMatchUtils.d.ts +1 -7
- package/dist/dialect/jsonArrayElemMatchUtils.js +1 -7
- package/dist/dialect/jsonSql.d.ts +6 -27
- package/dist/dialect/jsonSql.js +6 -27
- package/dist/dialect/mergeSqlDialect.d.ts +4 -22
- package/dist/dialect/mergeSqlDialect.js +4 -22
- package/dist/dialect/mysqlLikeSqlDialect.d.ts +11 -37
- package/dist/dialect/mysqlLikeSqlDialect.js +35 -51
- package/dist/dialect/pgLikeSqlDialect.d.ts +8 -22
- package/dist/dialect/pgLikeSqlDialect.js +36 -39
- package/dist/dialect/queryContext.d.ts +4 -22
- package/dist/dialect/queryContext.js +4 -22
- package/dist/dialect/queryJoins.d.ts +3 -12
- package/dist/dialect/queryJoins.js +3 -12
- package/dist/dialect/vectorCast.d.ts +2 -12
- package/dist/dialect/vectorCast.js +3 -19
- package/dist/dialect/vectorSqlDialect.d.ts +8 -38
- package/dist/dialect/vectorSqlDialect.js +7 -38
- package/dist/entity/decorator/bag.d.ts +6 -19
- package/dist/entity/decorator/bag.js +6 -22
- package/dist/entity/decorator/entity.d.ts +2 -7
- package/dist/entity/decorator/entity.js +2 -7
- package/dist/entity/decorator/members.d.ts +7 -30
- package/dist/entity/decorator/members.js +3 -12
- package/dist/entity/metadata/definition.d.ts +2 -18
- package/dist/entity/metadata/definition.js +6 -28
- package/dist/http/handler.d.ts +2 -14
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/libsql/libsqlDialect.d.ts +1 -8
- package/dist/libsql/libsqlDialect.js +1 -8
- package/dist/maria/mariaDialect.d.ts +3 -5
- package/dist/maria/mariaDialect.js +5 -5
- package/dist/maria/mariadbQuerier.js +2 -2
- package/dist/maria/mariadbQuerierPool.js +1 -6
- package/dist/migrate/builder/migrationBuilder.js +3 -19
- package/dist/migrate/builder/splitSqlStatements.d.ts +1 -14
- package/dist/migrate/builder/splitSqlStatements.js +2 -22
- package/dist/migrate/builder/types.d.ts +2 -15
- package/dist/migrate/cli-config.js +2 -11
- package/dist/migrate/cli.js +2 -7
- package/dist/migrate/codegen/entityCodeGenerator.d.ts +0 -15
- package/dist/migrate/codegen/entityCodeGenerator.js +15 -44
- package/dist/migrate/codegen/fieldOptionsSource.d.ts +1 -8
- package/dist/migrate/codegen/fieldOptionsSource.js +3 -22
- package/dist/migrate/ddl/indexDdl.d.ts +2 -5
- package/dist/migrate/ddl/indexDdl.js +2 -5
- package/dist/migrate/ddl/pgIndexDdl.d.ts +3 -13
- package/dist/migrate/ddl/pgIndexDdl.js +3 -13
- package/dist/migrate/generator/definitionToNode.d.ts +2 -9
- package/dist/migrate/generator/definitionToNode.js +3 -17
- package/dist/migrate/generator/indexNodeToSchema.d.ts +2 -3
- package/dist/migrate/generator/indexNodeToSchema.js +2 -3
- package/dist/migrate/generator/mongoCommand.d.ts +1 -8
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts +1 -8
- package/dist/migrate/generator/mongoSchemaGenerator.js +1 -8
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +6 -26
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +9 -41
- package/dist/migrate/introspection/baseSqlIntrospector.js +0 -1
- package/dist/migrate/introspection/mongoIntrospector.d.ts +3 -1
- package/dist/migrate/introspection/mongoIntrospector.js +48 -46
- package/dist/migrate/introspection/mssqlIntrospector.d.ts +4 -4
- package/dist/migrate/introspection/mssqlIntrospector.js +18 -27
- package/dist/migrate/introspection/mysqlIntrospector.d.ts +7 -2
- package/dist/migrate/introspection/mysqlIntrospector.js +16 -14
- package/dist/migrate/introspection/postgresIntrospector.d.ts +24 -9
- package/dist/migrate/introspection/postgresIntrospector.js +68 -59
- package/dist/migrate/introspection/sqliteIntrospector.d.ts +1 -1
- package/dist/migrate/introspection/sqliteIntrospector.js +8 -10
- package/dist/migrate/migrator.d.ts +9 -53
- package/dist/migrate/migrator.js +32 -65
- package/dist/migrate/schemaGenerator.d.ts +16 -66
- package/dist/migrate/schemaGenerator.js +21 -74
- package/dist/mongo/mongoDialect.d.ts +21 -53
- package/dist/mongo/mongoDialect.js +25 -70
- package/dist/mongo/mongodbQuerier.d.ts +5 -8
- package/dist/mongo/mongodbQuerier.js +31 -65
- package/dist/mssql/mssqlDialect.d.ts +8 -34
- package/dist/mssql/mssqlDialect.js +37 -51
- package/dist/mssql/mssqlQuerier.d.ts +37 -4
- package/dist/mssql/mssqlQuerier.js +2 -2
- package/dist/mssql/mssqlWireTypes.d.ts +2 -14
- package/dist/mssql/mssqlWireTypes.js +2 -14
- package/dist/nestjs/uqlModule.js +2 -7
- package/dist/pglite/pgliteQuerier.d.ts +1 -9
- package/dist/pglite/pgliteQuerierPool.d.ts +4 -26
- package/dist/pglite/pgliteQuerierPool.js +3 -18
- package/dist/postgres/abstractPgQuerierPool.d.ts +1 -8
- package/dist/postgres/abstractPgQuerierPool.js +1 -8
- package/dist/postgres/pgNumericTypes.d.ts +3 -26
- package/dist/postgres/pgNumericTypes.js +3 -26
- package/dist/postgres/postgresDialect.d.ts +4 -10
- package/dist/postgres/postgresDialect.js +4 -10
- package/dist/querier/abstractQuerier.d.ts +35 -103
- package/dist/querier/abstractQuerier.js +105 -201
- package/dist/querier/abstractSharedHandleQuerierPool.d.ts +3 -17
- package/dist/querier/abstractSharedHandleQuerierPool.js +3 -17
- package/dist/querier/abstractSqlQuerier.d.ts +15 -36
- package/dist/querier/abstractSqlQuerier.js +49 -131
- package/dist/schema/canonicalType.d.ts +3 -21
- package/dist/schema/canonicalType.js +22 -67
- package/dist/schema/dependencyGraph.d.ts +2 -8
- package/dist/schema/dependencyGraph.js +2 -32
- package/dist/schema/index.d.ts +1 -25
- package/dist/schema/index.js +0 -26
- package/dist/schema/indexColumns.d.ts +1 -8
- package/dist/schema/indexColumns.js +1 -8
- package/dist/schema/indexDifferences.d.ts +7 -40
- package/dist/schema/indexDifferences.js +6 -31
- package/dist/schema/schemaAST.d.ts +8 -175
- package/dist/schema/schemaAST.js +13 -365
- package/dist/schema/schemaASTBuilder.d.ts +2 -24
- package/dist/schema/schemaASTBuilder.js +2 -30
- package/dist/schema/schemaASTDiffer.d.ts +6 -46
- package/dist/schema/schemaASTDiffer.js +8 -56
- package/dist/schema/types.d.ts +5 -61
- package/dist/schema/types.js +3 -6
- package/dist/sqlite/abstractSqliteQuerier.d.ts +1 -8
- package/dist/sqlite/localSqliteQuerierPool.d.ts +1 -7
- package/dist/sqlite/localSqliteQuerierPool.js +1 -7
- package/dist/sqlite/nodeSqliteQuerierPool.d.ts +2 -7
- package/dist/sqlite/nodeSqliteQuerierPool.js +2 -7
- package/dist/sqlite/sqliteDialect.d.ts +5 -20
- package/dist/sqlite/sqliteDialect.js +29 -35
- package/dist/turso/tursoDialect.d.ts +4 -6
- package/dist/turso/tursoDialect.js +4 -6
- package/dist/turso/tursoLocalQuerierPool.d.ts +1 -7
- package/dist/turso/tursoLocalQuerierPool.js +1 -7
- package/dist/turso/tursoQuerierPool.d.ts +2 -6
- package/dist/turso/tursoQuerierPool.js +2 -6
- package/dist/turso/tursoSessionQuerier.d.ts +1 -7
- package/dist/turso/tursoSessionQuerier.js +1 -7
- package/dist/type/dialect.d.ts +42 -94
- package/dist/type/dialect.js +3 -13
- package/dist/type/entity.d.ts +163 -534
- package/dist/type/entity.js +26 -9
- package/dist/type/logger.d.ts +2 -14
- package/dist/type/migration.d.ts +9 -38
- package/dist/type/querier.d.ts +9 -28
- package/dist/type/querierPool.d.ts +4 -26
- package/dist/type/query.d.ts +19 -73
- package/dist/type/query.js +2 -7
- package/dist/type/queryAggregate.d.ts +18 -98
- package/dist/type/queryRaw.d.ts +1 -8
- package/dist/type/queryRaw.js +1 -8
- package/dist/type/queryWhere.d.ts +13 -61
- package/dist/type/universalQuerier.d.ts +18 -105
- package/dist/type/utility.d.ts +12 -24
- package/dist/type/vector.d.ts +8 -38
- package/dist/type/vector.js +1 -1
- package/dist/type/wire.d.ts +2 -5
- package/dist/util/dialect.util.d.ts +9 -27
- package/dist/util/dialect.util.js +10 -27
- package/dist/util/field.util.d.ts +2 -31
- package/dist/util/field.util.js +3 -43
- package/dist/util/fieldOption.util.d.ts +7 -15
- package/dist/util/fieldOption.util.js +1 -1
- package/dist/util/filters.util.d.ts +2 -5
- package/dist/util/filters.util.js +2 -5
- package/dist/util/logger.d.ts +2 -6
- package/dist/util/logger.js +2 -6
- package/dist/util/object.util.d.ts +2 -6
- package/dist/util/object.util.js +1 -5
- package/dist/util/raw.d.ts +3 -23
- package/dist/util/relationQuery.util.d.ts +3 -14
- package/dist/util/relationQuery.util.js +3 -14
- package/dist/util/rowKey.util.d.ts +2 -10
- package/dist/util/rowKey.util.js +2 -10
- package/dist/util/sql.util.d.ts +6 -37
- package/dist/util/sql.util.js +13 -73
- package/dist/util/sqlLiteral.d.ts +2 -13
- package/dist/util/sqlLiteral.js +8 -13
- package/dist/util/string.util.js +0 -2
- package/package.json +4 -4
|
@@ -15,24 +15,14 @@ export declare class PgIndexDdl extends IndexDdl {
|
|
|
15
15
|
protected isVectorIndex(index: IndexSchema): boolean;
|
|
16
16
|
protected indexAccessMethod(index: IndexSchema): string;
|
|
17
17
|
/**
|
|
18
|
-
* A vector index's operator class
|
|
19
|
-
*
|
|
20
|
-
* distance throws rather than being omitted, since a bare `USING hnsw ("embedding")` would build
|
|
21
|
-
* with the dialect's default metric instead of the one requested, with nothing signalling it.
|
|
22
|
-
* Everything else takes the operator class the entry declares, e.g. `jsonb_path_ops` for GIN.
|
|
18
|
+
* A vector index's operator class, `{type}_{metric}_ops` (`halfvec_cosine_ops`), refusing a metric it
|
|
19
|
+
* lacks rather than build with the default; any other entry takes the class it declares.
|
|
23
20
|
*/
|
|
24
21
|
protected indexColumnOpsClass(entry: IndexColumnSchema, index: IndexSchema): string;
|
|
25
22
|
protected indexInclude(index: IndexSchema): string;
|
|
26
23
|
protected indexTuning(index: IndexSchema): string;
|
|
27
24
|
}
|
|
28
|
-
/**
|
|
29
|
-
* CockroachDB's vector index is native and has its own syntax: `CREATE VECTOR INDEX ... ("col"
|
|
30
|
-
* vector_cosine_ops)`, with no access-method keyword, and tuning knobs of its own names that UQL
|
|
31
|
-
* does not map. `type: 'vector'` is its trigger, the same generic value MariaDB's index uses.
|
|
32
|
-
*
|
|
33
|
-
* `NULLS FIRST/LAST` answers "unimplemented: this syntax" and `jsonb_path_ops` "operator class is
|
|
34
|
-
* not supported" (both verified on v26.2), so neither is offered here.
|
|
35
|
-
*/
|
|
25
|
+
/** CockroachDB's native `CREATE VECTOR INDEX`, for `type: 'vector'`; it has neither `NULLS FIRST/LAST` nor `jsonb_path_ops`. */
|
|
36
26
|
export declare class CockroachIndexDdl extends PgIndexDdl {
|
|
37
27
|
protected readonly indexFeatures: Set<"expression" | "include" | "jsonArray" | "jsonPath" | "nullsOrder" | "opsClass" | "partial" | "prefixLength">;
|
|
38
28
|
/** v26.3 answers `hash` and `brin` "unimplemented", `ivfflat` "unrecognized"; `hnsw` builds its vector index. */
|
|
@@ -36,11 +36,8 @@ export class PgIndexDdl extends IndexDdl {
|
|
|
36
36
|
return index.type ? ` USING ${index.type}` : '';
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* A vector index's operator class
|
|
40
|
-
*
|
|
41
|
-
* distance throws rather than being omitted, since a bare `USING hnsw ("embedding")` would build
|
|
42
|
-
* with the dialect's default metric instead of the one requested, with nothing signalling it.
|
|
43
|
-
* Everything else takes the operator class the entry declares, e.g. `jsonb_path_ops` for GIN.
|
|
39
|
+
* A vector index's operator class, `{type}_{metric}_ops` (`halfvec_cosine_ops`), refusing a metric it
|
|
40
|
+
* lacks rather than build with the default; any other entry takes the class it declares.
|
|
44
41
|
*/
|
|
45
42
|
indexColumnOpsClass(entry, index) {
|
|
46
43
|
if (!this.isVectorIndex(index) || !index.distance) {
|
|
@@ -77,14 +74,7 @@ export class PgIndexDdl extends IndexDdl {
|
|
|
77
74
|
return params.length > 0 ? ` WITH (${params.join(', ')})` : '';
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
|
-
/**
|
|
81
|
-
* CockroachDB's vector index is native and has its own syntax: `CREATE VECTOR INDEX ... ("col"
|
|
82
|
-
* vector_cosine_ops)`, with no access-method keyword, and tuning knobs of its own names that UQL
|
|
83
|
-
* does not map. `type: 'vector'` is its trigger, the same generic value MariaDB's index uses.
|
|
84
|
-
*
|
|
85
|
-
* `NULLS FIRST/LAST` answers "unimplemented: this syntax" and `jsonb_path_ops` "operator class is
|
|
86
|
-
* not supported" (both verified on v26.2), so neither is offered here.
|
|
87
|
-
*/
|
|
77
|
+
/** CockroachDB's native `CREATE VECTOR INDEX`, for `type: 'vector'`; it has neither `NULLS FIRST/LAST` nor `jsonb_path_ops`. */
|
|
88
78
|
export class CockroachIndexDdl extends PgIndexDdl {
|
|
89
79
|
indexFeatures = new Set(['expression', 'partial', 'include', 'jsonPath']);
|
|
90
80
|
/** v26.3 answers `hash` and `brin` "unimplemented", `ivfflat` "unrecognized"; `hnsw` builds its vector index. */
|
|
@@ -9,15 +9,8 @@ import type { FullColumnDefinition, IndexDefinition, TableDefinition } from '../
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function tableDefinitionToNode(def: TableDefinition, render: (sql: QueryRaw) => string): TableNode;
|
|
11
11
|
/**
|
|
12
|
-
* A builder's column as the
|
|
13
|
-
*
|
|
14
|
-
* The shared half is spread, not copied field by field: `ColumnDefinition` *is* a `ColumnNode` minus
|
|
15
|
-
* the graph links, so spreading it and adding those back is a node by construction. Listed one by one,
|
|
16
|
-
* the copy silently dropped whatever the node gained next - `enum` first, and the type had no way to
|
|
17
|
-
* say so. The two builder-only keys are destructured off: `index` and `foreignKey` are lifted onto the
|
|
18
|
-
* table by `columnIndex`/`columnForeignKey`, which is the path that renders them.
|
|
19
|
-
*
|
|
20
|
-
* No `references` node either: `SchemaAST.addRelationship` sets that one.
|
|
12
|
+
* A builder's column as the node the generators render, spread so a field the node gains carries over.
|
|
13
|
+
* `index` and `foreignKey` are lifted onto the table elsewhere; `addRelationship` sets `references`.
|
|
21
14
|
*/
|
|
22
15
|
export declare function fullColumnDefinitionToNode(col: FullColumnDefinition, tableName: string): ColumnNode;
|
|
23
16
|
/**
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { renderIndexColumn } from '../../util/ddlExpression.util.js';
|
|
2
2
|
import { derivedForeignKeyName, derivedIndexName } from '../../util/sql.util.js';
|
|
3
|
-
/**
|
|
4
|
-
* A table the builder names but has not seen.
|
|
5
|
-
*
|
|
6
|
-
* A `RelationshipNode` points at a whole `TableNode` because the AST wires `incomingRelations` through
|
|
7
|
-
* it; a builder creating one table has no node for the table its foreign key targets, and the
|
|
8
|
-
* generator reads only the name. Stated once, so the three casts it replaces cannot be mistaken for a
|
|
9
|
-
* node that was resolved and lost.
|
|
10
|
-
*/
|
|
3
|
+
/** A table the builder names but has not seen, which the generator reads only the name of. */
|
|
11
4
|
function unresolvedTable(name) {
|
|
12
5
|
return { name };
|
|
13
6
|
}
|
|
@@ -63,15 +56,8 @@ export function tableDefinitionToNode(def, render) {
|
|
|
63
56
|
return table;
|
|
64
57
|
}
|
|
65
58
|
/**
|
|
66
|
-
* A builder's column as the
|
|
67
|
-
*
|
|
68
|
-
* The shared half is spread, not copied field by field: `ColumnDefinition` *is* a `ColumnNode` minus
|
|
69
|
-
* the graph links, so spreading it and adding those back is a node by construction. Listed one by one,
|
|
70
|
-
* the copy silently dropped whatever the node gained next - `enum` first, and the type had no way to
|
|
71
|
-
* say so. The two builder-only keys are destructured off: `index` and `foreignKey` are lifted onto the
|
|
72
|
-
* table by `columnIndex`/`columnForeignKey`, which is the path that renders them.
|
|
73
|
-
*
|
|
74
|
-
* No `references` node either: `SchemaAST.addRelationship` sets that one.
|
|
59
|
+
* A builder's column as the node the generators render, spread so a field the node gains carries over.
|
|
60
|
+
* `index` and `foreignKey` are lifted onto the table elsewhere; `addRelationship` sets `references`.
|
|
75
61
|
*/
|
|
76
62
|
export function fullColumnDefinitionToNode(col, tableName) {
|
|
77
63
|
const { index: _index, foreignKey: _foreignKey, ...column } = col;
|
|
@@ -2,8 +2,7 @@ import type { IndexNode } from '../../schema/types.js';
|
|
|
2
2
|
import type { IndexSchema } from '../../type/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* An AST index as the generators and dialects want it. Spread rather than copied field by field:
|
|
5
|
-
* rebuilding it by hand is how the partial-index `where` once vanished without a trace.
|
|
6
|
-
*
|
|
7
|
-
* because pgvector's operator-class names are built from it.
|
|
5
|
+
* rebuilding it by hand is how the partial-index `where` once vanished without a trace. Its `table` is
|
|
6
|
+
* ignored downstream, and the vector type travels along because pgvector's operator-class names are built from it.
|
|
8
7
|
*/
|
|
9
8
|
export declare function indexNodeToSchema(index: IndexNode): IndexSchema;
|
|
@@ -2,9 +2,8 @@ import { isVectorCategory } from '../../schema/canonicalType.js';
|
|
|
2
2
|
import { indexColumns } from '../../schema/indexColumns.js';
|
|
3
3
|
/**
|
|
4
4
|
* An AST index as the generators and dialects want it. Spread rather than copied field by field:
|
|
5
|
-
* rebuilding it by hand is how the partial-index `where` once vanished without a trace.
|
|
6
|
-
*
|
|
7
|
-
* because pgvector's operator-class names are built from it.
|
|
5
|
+
* rebuilding it by hand is how the partial-index `where` once vanished without a trace. Its `table` is
|
|
6
|
+
* ignored downstream, and the vector type travels along because pgvector's operator-class names are built from it.
|
|
8
7
|
*/
|
|
9
8
|
export function indexNodeToSchema(index) {
|
|
10
9
|
return {
|
|
@@ -6,14 +6,7 @@ export type MongoIndexOptions = {
|
|
|
6
6
|
readonly name: string;
|
|
7
7
|
readonly partialFilterExpression?: Readonly<Record<string, unknown>>;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* `SchemaGenerator` yields one string per statement, so {@link MongoSchemaGenerator} emits its
|
|
11
|
-
* commands as JSON and this is their schema.
|
|
12
|
-
*
|
|
13
|
-
* Declared next to the generator that writes them because the migrator used to restate the shape
|
|
14
|
-
* inline from `JSON.parse`, with `cmd.name!` assertions and a bare `action: string` - where a command
|
|
15
|
-
* it had no branch for was silently a no-op.
|
|
16
|
-
*/
|
|
9
|
+
/** The commands {@link MongoSchemaGenerator} emits as JSON, one per statement. */
|
|
17
10
|
export type MongoCommand = {
|
|
18
11
|
readonly action: 'createCollection';
|
|
19
12
|
readonly name: string;
|
|
@@ -33,14 +33,7 @@ export declare class MongoSchemaGenerator extends MongoDialect implements Schema
|
|
|
33
33
|
generateDropTable(tableName: string): string;
|
|
34
34
|
generateAlterTable(diff: SchemaDiff): string[];
|
|
35
35
|
generateAlterTableDown(diff: SchemaDiff): string[];
|
|
36
|
-
/**
|
|
37
|
-
* MongoDB's key spec is where its index options live: `-1` for a descending entry and `'text'` for a
|
|
38
|
-
* full-text index, which is what `$text` needs since a text index declares its own fields.
|
|
39
|
-
*
|
|
40
|
-
* @remarks The SQL-only options are refused by the checks the SQL dialects refuse each other's with - a
|
|
41
|
-
* silently weaker index is worse than a clear failure. `where` is the filter's JSON, as
|
|
42
|
-
* {@link compileIndexPredicate} writes it.
|
|
43
|
-
*/
|
|
36
|
+
/** An index as MongoDB's key spec (`-1` descending, `'text'` full-text), refusing the SQL-only options. */
|
|
44
37
|
generateCreateIndex(tableName: string, index: IndexSchema): string;
|
|
45
38
|
generateDropIndex(tableName: string, indexName: string): string;
|
|
46
39
|
/** A collection and its indexes, which is all a document store has: a column, a constraint or SQL throws. */
|
|
@@ -96,14 +96,7 @@ export class MongoSchemaGenerator extends MongoDialect {
|
|
|
96
96
|
generateAlterTableDown(diff) {
|
|
97
97
|
return (diff.indexesToAdd ?? []).map((index) => this.generateDropIndex(diff.tableName, index.name));
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
* MongoDB's key spec is where its index options live: `-1` for a descending entry and `'text'` for a
|
|
101
|
-
* full-text index, which is what `$text` needs since a text index declares its own fields.
|
|
102
|
-
*
|
|
103
|
-
* @remarks The SQL-only options are refused by the checks the SQL dialects refuse each other's with - a
|
|
104
|
-
* silently weaker index is worse than a clear failure. `where` is the filter's JSON, as
|
|
105
|
-
* {@link compileIndexPredicate} writes it.
|
|
106
|
-
*/
|
|
99
|
+
/** An index as MongoDB's key spec (`-1` descending, `'text'` full-text), refusing the SQL-only options. */
|
|
107
100
|
generateCreateIndex(tableName, index) {
|
|
108
101
|
assertIndexType(index, MONGO_INDEX_TYPES, this.dialectName);
|
|
109
102
|
assertIndexFeatures(index, MONGO_INDEX_FEATURES, this.dialectName);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ForeignKeyAction } from '../../schema/types.js';
|
|
2
2
|
import type { ColumnSchema, ForeignKeySchema, IndexSchema, QuerierPool, RawRow, SchemaIntrospector, SqlQuerier, TableSchema } from '../../type/index.js';
|
|
3
3
|
import { BaseSqlIntrospector } from './baseSqlIntrospector.js';
|
|
4
4
|
/**
|
|
@@ -12,32 +12,14 @@ import { BaseSqlIntrospector } from './baseSqlIntrospector.js';
|
|
|
12
12
|
* it is four avoidable ones.
|
|
13
13
|
*/
|
|
14
14
|
export type TableRowReader = <T extends RawRow>(sql: string, params?: unknown[]) => Promise<T[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Abstract base class for SQL schema introspectors.
|
|
17
|
-
*
|
|
18
|
-
* Uses the template-method pattern to consolidate shared logic while allowing
|
|
19
|
-
* dialect-specific implementations for SQL queries and type normalization.
|
|
20
|
-
*
|
|
21
|
-
* Subclasses must implement:
|
|
22
|
-
* - `getTableNamesQuery()` - SQL to list all table names
|
|
23
|
-
* - `tableExistsQuery()` - SQL to check if a table exists
|
|
24
|
-
* - `getColumnsQuery()` - SQL to get column metadata
|
|
25
|
-
* - `getIndexesQuery()` - SQL to get index metadata
|
|
26
|
-
* - `getForeignKeysQuery()` - SQL to get foreign key metadata
|
|
27
|
-
* - `getPrimaryKeyQuery()` - SQL to get primary key columns
|
|
28
|
-
* - `mapColumnRow()` - Map a column query result row to ColumnSchema
|
|
29
|
-
* - `mapIndexRow()` - Map an index query result row to IndexSchema
|
|
30
|
-
* - `mapForeignKeyRow()` - Map a foreign key query result row to ForeignKeySchema
|
|
31
|
-
* - `mapTableNameRow()` - Extract table name from a row
|
|
32
|
-
* - `mapPrimaryKeyRow()` - Extract column name from a PK row
|
|
33
|
-
*/
|
|
15
|
+
/** A SQL introspector: an engine states its catalogue queries (`get*Query`) and how their rows map (`map*Result`). */
|
|
34
16
|
export declare abstract class AbstractSqlSchemaIntrospector extends BaseSqlIntrospector implements SchemaIntrospector {
|
|
35
17
|
protected readonly pool: QuerierPool;
|
|
36
18
|
constructor(pool: QuerierPool, schema?: string);
|
|
37
19
|
/**
|
|
38
|
-
* The schema every catalogue query filters on, as SQL: the one that was asked for,
|
|
39
|
-
* expression for the connection's default. A literal rather than a bind
|
|
40
|
-
* queries are assembled as text and several use it more than once.
|
|
20
|
+
* The schema every catalogue query filters on, as SQL: the one that was asked for, as the engine's
|
|
21
|
+
* own literal, or its expression for the connection's default. A literal rather than a bind
|
|
22
|
+
* parameter because these queries are assembled as text and several use it more than once.
|
|
41
23
|
*/
|
|
42
24
|
protected get schemaExpr(): string;
|
|
43
25
|
/**
|
|
@@ -66,9 +48,7 @@ export declare abstract class AbstractSqlSchemaIntrospector extends BaseSqlIntro
|
|
|
66
48
|
protected getIndexesParams(tableName: string): unknown[];
|
|
67
49
|
protected getForeignKeysParams(tableName: string): unknown[];
|
|
68
50
|
protected getPrimaryKeyParams(tableName: string): unknown[];
|
|
69
|
-
/**
|
|
70
|
-
* Normalize referential action string to standard type.
|
|
71
|
-
*/
|
|
51
|
+
/** The {@link ForeignKeyAction} a catalogue names, whatever its case. */
|
|
72
52
|
protected normalizeReferentialAction(action: string): ForeignKeyAction | undefined;
|
|
73
53
|
/**
|
|
74
54
|
* Convert bigint/null values to number safely.
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
+
import { FOREIGN_KEY_ACTIONS } from '../../schema/types.js';
|
|
1
2
|
import { isSqlQuerier } from '../../type/index.js';
|
|
2
|
-
import { escapeAnsiSqlLiteral } from '../../util/sqlLiteral.js';
|
|
3
3
|
import { BaseSqlIntrospector } from './baseSqlIntrospector.js';
|
|
4
|
-
/**
|
|
5
|
-
* Abstract base class for SQL schema introspectors.
|
|
6
|
-
*
|
|
7
|
-
* Uses the template-method pattern to consolidate shared logic while allowing
|
|
8
|
-
* dialect-specific implementations for SQL queries and type normalization.
|
|
9
|
-
*
|
|
10
|
-
* Subclasses must implement:
|
|
11
|
-
* - `getTableNamesQuery()` - SQL to list all table names
|
|
12
|
-
* - `tableExistsQuery()` - SQL to check if a table exists
|
|
13
|
-
* - `getColumnsQuery()` - SQL to get column metadata
|
|
14
|
-
* - `getIndexesQuery()` - SQL to get index metadata
|
|
15
|
-
* - `getForeignKeysQuery()` - SQL to get foreign key metadata
|
|
16
|
-
* - `getPrimaryKeyQuery()` - SQL to get primary key columns
|
|
17
|
-
* - `mapColumnRow()` - Map a column query result row to ColumnSchema
|
|
18
|
-
* - `mapIndexRow()` - Map an index query result row to IndexSchema
|
|
19
|
-
* - `mapForeignKeyRow()` - Map a foreign key query result row to ForeignKeySchema
|
|
20
|
-
* - `mapTableNameRow()` - Extract table name from a row
|
|
21
|
-
* - `mapPrimaryKeyRow()` - Extract column name from a PK row
|
|
22
|
-
*/
|
|
4
|
+
/** A SQL introspector: an engine states its catalogue queries (`get*Query`) and how their rows map (`map*Result`). */
|
|
23
5
|
export class AbstractSqlSchemaIntrospector extends BaseSqlIntrospector {
|
|
24
6
|
pool;
|
|
25
7
|
constructor(pool, schema) {
|
|
@@ -27,12 +9,12 @@ export class AbstractSqlSchemaIntrospector extends BaseSqlIntrospector {
|
|
|
27
9
|
this.pool = pool;
|
|
28
10
|
}
|
|
29
11
|
/**
|
|
30
|
-
* The schema every catalogue query filters on, as SQL: the one that was asked for,
|
|
31
|
-
* expression for the connection's default. A literal rather than a bind
|
|
32
|
-
* queries are assembled as text and several use it more than once.
|
|
12
|
+
* The schema every catalogue query filters on, as SQL: the one that was asked for, as the engine's
|
|
13
|
+
* own literal, or its expression for the connection's default. A literal rather than a bind
|
|
14
|
+
* parameter because these queries are assembled as text and several use it more than once.
|
|
33
15
|
*/
|
|
34
16
|
get schemaExpr() {
|
|
35
|
-
return this.schema === undefined ? this.defaultSchemaExpr :
|
|
17
|
+
return this.schema === undefined ? this.defaultSchemaExpr : this.dialect.escape(this.schema);
|
|
36
18
|
}
|
|
37
19
|
/**
|
|
38
20
|
* How this engine names the connection's current schema (Postgres) or database (MySQL). Empty on
|
|
@@ -118,24 +100,10 @@ export class AbstractSqlSchemaIntrospector extends BaseSqlIntrospector {
|
|
|
118
100
|
getPrimaryKeyParams(tableName) {
|
|
119
101
|
return [tableName];
|
|
120
102
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Normalize referential action string to standard type.
|
|
123
|
-
*/
|
|
103
|
+
/** The {@link ForeignKeyAction} a catalogue names, whatever its case. */
|
|
124
104
|
normalizeReferentialAction(action) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return 'CASCADE';
|
|
128
|
-
case 'SET NULL':
|
|
129
|
-
return 'SET NULL';
|
|
130
|
-
case 'RESTRICT':
|
|
131
|
-
return 'RESTRICT';
|
|
132
|
-
case 'NO ACTION':
|
|
133
|
-
return 'NO ACTION';
|
|
134
|
-
case 'SET DEFAULT':
|
|
135
|
-
return 'SET DEFAULT';
|
|
136
|
-
default:
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
105
|
+
const upper = action.toUpperCase();
|
|
106
|
+
return FOREIGN_KEY_ACTIONS.find((known) => known === upper);
|
|
139
107
|
}
|
|
140
108
|
/**
|
|
141
109
|
* Convert bigint/null values to number safely.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IndexFacet } from '../../schema/indexDifferences.js';
|
|
2
2
|
import { SchemaAST } from '../../schema/schemaAST.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type QuerierPool, type SchemaIntrospector, type TableSchema } from '../../type/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* MongoDB schema introspector.
|
|
6
6
|
* MongoDB doesn't have a fixed schema, so this primarily focuses on collections and indexes.
|
|
@@ -12,6 +12,8 @@ export declare class MongoSchemaIntrospector implements SchemaIntrospector {
|
|
|
12
12
|
constructor(pool: QuerierPool);
|
|
13
13
|
introspect(tables?: readonly string[]): Promise<SchemaAST>;
|
|
14
14
|
getTableSchema(tableName: string): Promise<TableSchema | undefined>;
|
|
15
|
+
/** Collections only, the way a SQL engine lists its base tables: no view, nor the `system.views` behind one. */
|
|
15
16
|
getTableNames(): Promise<string[]>;
|
|
16
17
|
tableExists(tableName: string): Promise<boolean>;
|
|
18
|
+
private withDb;
|
|
17
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SchemaAST } from '../../schema/schemaAST.js';
|
|
1
|
+
import { createTableNode, SchemaAST } from '../../schema/schemaAST.js';
|
|
2
|
+
import { isMongoQuerier, } from '../../type/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* MongoDB schema introspector.
|
|
4
5
|
* MongoDB doesn't have a fixed schema, so this primarily focuses on collections and indexes.
|
|
@@ -16,55 +17,22 @@ export class MongoSchemaIntrospector {
|
|
|
16
17
|
for (const name of tableNames) {
|
|
17
18
|
const schema = await this.getTableSchema(name);
|
|
18
19
|
if (schema) {
|
|
19
|
-
|
|
20
|
-
const table = {
|
|
21
|
-
name,
|
|
22
|
-
columns,
|
|
23
|
-
primaryKey: [],
|
|
24
|
-
indexes: [],
|
|
25
|
-
incomingRelations: [],
|
|
26
|
-
outgoingRelations: [],
|
|
27
|
-
};
|
|
28
|
-
if (schema.indexes) {
|
|
29
|
-
for (const idx of schema.indexes) {
|
|
30
|
-
for (const { column: colName } of idx.entries) {
|
|
31
|
-
let column = columns.get(colName);
|
|
32
|
-
if (!column) {
|
|
33
|
-
column = {
|
|
34
|
-
name: colName,
|
|
35
|
-
type: { category: 'string' }, // MongoDB fields are flexible, but indexes usually target strings/numbers
|
|
36
|
-
nullable: true,
|
|
37
|
-
isPrimaryKey: false,
|
|
38
|
-
isAutoIncrement: false,
|
|
39
|
-
isUnique: false,
|
|
40
|
-
table,
|
|
41
|
-
referencedBy: [],
|
|
42
|
-
};
|
|
43
|
-
columns.set(colName, column);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
table.indexes.push({ name: idx.name, table, entries: idx.entries, unique: idx.unique });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
ast.addTable(table);
|
|
20
|
+
ast.addTable(buildTable(schema));
|
|
50
21
|
}
|
|
51
22
|
}
|
|
52
23
|
return ast;
|
|
53
24
|
}
|
|
54
25
|
async getTableSchema(tableName) {
|
|
55
|
-
return this.
|
|
56
|
-
|
|
57
|
-
const collections = await db.listCollections({ name: tableName }).toArray();
|
|
58
|
-
if (collections.length === 0) {
|
|
26
|
+
return this.withDb(async (db) => {
|
|
27
|
+
if (!(await hasCollection(db, tableName))) {
|
|
59
28
|
return undefined;
|
|
60
29
|
}
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
// silently made every field below unchecked.
|
|
30
|
+
// Annotated rather than inferred: the driver's `indexes()` is overloaded and resolves to `any` on
|
|
31
|
+
// some versions, which silently made every field below unchecked.
|
|
64
32
|
const indexes = await db.collection(tableName).indexes();
|
|
65
33
|
return {
|
|
66
34
|
name: tableName,
|
|
67
|
-
columns: [],
|
|
35
|
+
columns: [],
|
|
68
36
|
indexes: indexes.map((idx) => ({
|
|
69
37
|
name: idx.name ?? Object.keys(idx.key).join('_'),
|
|
70
38
|
entries: Object.keys(idx.key).map((column) => ({ column })),
|
|
@@ -73,15 +41,49 @@ export class MongoSchemaIntrospector {
|
|
|
73
41
|
};
|
|
74
42
|
});
|
|
75
43
|
}
|
|
44
|
+
/** Collections only, the way a SQL engine lists its base tables: no view, nor the `system.views` behind one. */
|
|
76
45
|
async getTableNames() {
|
|
77
|
-
return this.
|
|
78
|
-
const {
|
|
79
|
-
const collections = await db.listCollections().toArray();
|
|
80
|
-
return collections.map((
|
|
46
|
+
return this.withDb(async (db) => {
|
|
47
|
+
const filter = { type: 'collection', name: { $not: /^system\./ } };
|
|
48
|
+
const collections = await db.listCollections(filter, { nameOnly: true }).toArray();
|
|
49
|
+
return collections.map((collection) => collection.name);
|
|
81
50
|
});
|
|
82
51
|
}
|
|
83
52
|
async tableExists(tableName) {
|
|
84
|
-
|
|
85
|
-
return names.includes(tableName);
|
|
53
|
+
return this.withDb((db) => hasCollection(db, tableName));
|
|
86
54
|
}
|
|
55
|
+
withDb(task) {
|
|
56
|
+
return this.pool.withQuerier((querier) => {
|
|
57
|
+
if (!isMongoQuerier(querier)) {
|
|
58
|
+
throw new TypeError('MongoSchemaIntrospector requires a MongoDB querier');
|
|
59
|
+
}
|
|
60
|
+
return task(querier.db);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function hasCollection(db, name) {
|
|
65
|
+
const collections = await db.listCollections({ name, type: 'collection' }, { nameOnly: true }).toArray();
|
|
66
|
+
return collections.length > 0;
|
|
67
|
+
}
|
|
68
|
+
/** Mongo has no columns to read, so a table's are the fields its indexes name, one node per field. */
|
|
69
|
+
function buildTable({ name, indexes = [] }) {
|
|
70
|
+
const table = createTableNode(name);
|
|
71
|
+
for (const index of indexes) {
|
|
72
|
+
for (const { column } of index.entries) {
|
|
73
|
+
if (!table.columns.has(column)) {
|
|
74
|
+
table.columns.set(column, {
|
|
75
|
+
name: column,
|
|
76
|
+
type: { category: 'string' },
|
|
77
|
+
nullable: true,
|
|
78
|
+
isPrimaryKey: false,
|
|
79
|
+
isAutoIncrement: false,
|
|
80
|
+
isUnique: false,
|
|
81
|
+
table,
|
|
82
|
+
referencedBy: [],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
table.indexes.push({ name: index.name, table, entries: index.entries, unique: index.unique });
|
|
87
|
+
}
|
|
88
|
+
return table;
|
|
87
89
|
}
|
|
@@ -12,8 +12,8 @@ export declare class MsSqlSchemaIntrospector extends AbstractSqlSchemaIntrospect
|
|
|
12
12
|
protected readonly defaultSchemaExpr = "SCHEMA_NAME()";
|
|
13
13
|
protected getTableNamesQuery(): string;
|
|
14
14
|
protected tableExistsQuery(): string;
|
|
15
|
-
protected parseTableExistsResult(
|
|
16
|
-
count
|
|
15
|
+
protected parseTableExistsResult([row]: {
|
|
16
|
+
count: number;
|
|
17
17
|
}[]): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* From `sys` rather than `INFORMATION_SCHEMA`, which has no identity flag and no per-column view of
|
|
@@ -40,8 +40,8 @@ export declare class MsSqlSchemaIntrospector extends AbstractSqlSchemaIntrospect
|
|
|
40
40
|
update_rule: string;
|
|
41
41
|
}[]): Promise<ForeignKeySchema[]>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
* `(N'x')`
|
|
43
|
+
* The engine reprints a default from its own parse tree: all of it in one pair of parentheses, and a
|
|
44
|
+
* number in a second, so `((0))`, `((1)+(2))`, `(N'x')` and `(getdate())`.
|
|
45
45
|
*/
|
|
46
46
|
protected parseDefaultValue(defaultValue: string | null): unknown;
|
|
47
47
|
}
|
|
@@ -26,9 +26,8 @@ export class MsSqlSchemaIntrospector extends AbstractSqlSchemaIntrospector {
|
|
|
26
26
|
AND TABLE_NAME = @p1
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
|
-
parseTableExistsResult(
|
|
30
|
-
|
|
31
|
-
return Number(results[0]?.count) > 0;
|
|
29
|
+
parseTableExistsResult([row]) {
|
|
30
|
+
return row.count > 0;
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* From `sys` rather than `INFORMATION_SCHEMA`, which has no identity flag and no per-column view of
|
|
@@ -142,46 +141,38 @@ export class MsSqlSchemaIntrospector extends AbstractSqlSchemaIntrospector {
|
|
|
142
141
|
async mapIndexesResult(_read, _tableName, results) {
|
|
143
142
|
return results.map((row) => ({
|
|
144
143
|
name: row.index_name,
|
|
145
|
-
entries:
|
|
144
|
+
entries: row.columns.split(',').map((column) => ({ column })),
|
|
146
145
|
unique: Boolean(row.is_unique),
|
|
147
146
|
}));
|
|
148
147
|
}
|
|
149
148
|
async mapForeignKeysResult(_read, _tableName, results) {
|
|
150
149
|
return results.map((row) => ({
|
|
151
150
|
name: row.constraint_name,
|
|
152
|
-
columns:
|
|
153
|
-
references: { table: row.referenced_table, columns:
|
|
151
|
+
columns: row.columns.split(','),
|
|
152
|
+
references: { table: row.referenced_table, columns: row.referenced_columns.split(',') },
|
|
154
153
|
// `sys` spells them with an underscore: `SET_NULL`, `NO_ACTION`.
|
|
155
|
-
onDelete: this.normalizeReferentialAction(
|
|
156
|
-
onUpdate: this.normalizeReferentialAction(
|
|
154
|
+
onDelete: this.normalizeReferentialAction(row.delete_rule.replaceAll('_', ' ')),
|
|
155
|
+
onUpdate: this.normalizeReferentialAction(row.update_rule.replaceAll('_', ' ')),
|
|
157
156
|
}));
|
|
158
157
|
}
|
|
159
158
|
/**
|
|
160
|
-
*
|
|
161
|
-
* `(N'x')`
|
|
159
|
+
* The engine reprints a default from its own parse tree: all of it in one pair of parentheses, and a
|
|
160
|
+
* number in a second, so `((0))`, `((1)+(2))`, `(N'x')` and `(getdate())`.
|
|
162
161
|
*/
|
|
163
162
|
parseDefaultValue(defaultValue) {
|
|
164
|
-
if (defaultValue === null
|
|
163
|
+
if (defaultValue === null) {
|
|
165
164
|
return undefined;
|
|
166
165
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
const text = defaultValue.slice(1, -1);
|
|
167
|
+
const number = /^\((-?\d+(?:\.\d+)?)\)$/.exec(text);
|
|
168
|
+
if (number) {
|
|
169
|
+
return Number(number[1]);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
const quoted = /^N?'(.*)'$/s.exec(text);
|
|
172
|
+
if (quoted) {
|
|
173
|
+
return quoted[1].replaceAll("''", "'");
|
|
173
174
|
}
|
|
174
|
-
|
|
175
|
-
if (unicode.startsWith("'") && unicode.endsWith("'")) {
|
|
176
|
-
return unicode.slice(1, -1).replaceAll("''", "'");
|
|
177
|
-
}
|
|
178
|
-
if (/^-?\d+$/.test(text)) {
|
|
179
|
-
return Number.parseInt(text, 10);
|
|
180
|
-
}
|
|
181
|
-
if (/^-?\d+\.\d+$/.test(text)) {
|
|
182
|
-
return Number.parseFloat(text);
|
|
183
|
-
}
|
|
184
|
-
return text;
|
|
175
|
+
return text === 'NULL' ? null : text;
|
|
185
176
|
}
|
|
186
177
|
}
|
|
187
178
|
/** The types whose `max_length` is a width rather than a fixed storage size. */
|
|
@@ -8,8 +8,8 @@ export declare class MysqlSchemaIntrospector extends AbstractSqlSchemaIntrospect
|
|
|
8
8
|
protected readonly defaultSchemaExpr = "DATABASE()";
|
|
9
9
|
protected getTableNamesQuery(): string;
|
|
10
10
|
protected tableExistsQuery(): string;
|
|
11
|
-
protected parseTableExistsResult(
|
|
12
|
-
count
|
|
11
|
+
protected parseTableExistsResult([row]: {
|
|
12
|
+
count: number | bigint;
|
|
13
13
|
}[]): boolean;
|
|
14
14
|
protected getColumnsQuery(_tableName: string): string;
|
|
15
15
|
protected getIndexesQuery(_tableName: string): string;
|
|
@@ -29,6 +29,11 @@ export declare class MysqlSchemaIntrospector extends AbstractSqlSchemaIntrospect
|
|
|
29
29
|
delete_rule: string;
|
|
30
30
|
update_rule: string;
|
|
31
31
|
}[]): Promise<ForeignKeySchema[]>;
|
|
32
|
+
/**
|
|
33
|
+
* MariaDB prints a string default as the literal it is (`'it''s'`). MySQL prints one bare, save an
|
|
34
|
+
* expression default (`DEFAULT ('x')`, what a `TEXT` column takes), which comes with a charset
|
|
35
|
+
* introducer and every quote and backslash escaped once more: `_utf8mb4\'x\'`.
|
|
36
|
+
*/
|
|
32
37
|
protected parseDefaultValue(defaultValue: string | null): unknown;
|
|
33
38
|
}
|
|
34
39
|
type MysqlColumnRow = {
|