uql-orm 0.99.0 → 0.100.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/LICENSE.md +22 -0
- package/README.md +1 -1
- package/dist/browser/uql-browser.min.js +2 -2
- package/dist/browser/uql-browser.min.js.map +5 -5
- package/dist/bunSql/bunSql.util.js +2 -2
- package/dist/bunSql/bunSqlQuerier.js +0 -1
- package/dist/bunSql/bunSqlQuerierPool.js +1 -1
- package/dist/cockroachdb/cockroachDialect.js +1 -0
- package/dist/context/context.browser.d.ts +5 -0
- package/dist/context/context.browser.js +21 -11
- package/dist/context/context.d.ts +5 -0
- package/dist/context/context.js +8 -3
- package/dist/dialect/abstractDialect.js +4 -2
- package/dist/dialect/abstractSqlDialect.d.ts +5 -5
- package/dist/dialect/abstractSqlDialect.js +26 -18
- package/dist/dialect/aliases.d.ts +0 -2
- package/dist/dialect/aliases.js +0 -2
- package/dist/dialect/hydrateColumn.d.ts +3 -3
- package/dist/dialect/hydrateColumn.js +1 -0
- package/dist/dialect/index.js +0 -2
- package/dist/dialect/jsonSql.d.ts +2 -3
- package/dist/dialect/jsonSql.js +4 -6
- package/dist/dialect/mysqlLikeSqlDialect.d.ts +1 -1
- package/dist/dialect/mysqlLikeSqlDialect.js +5 -3
- package/dist/dialect/operators.d.ts +2 -3
- package/dist/dialect/operators.js +3 -4
- package/dist/dialect/pgLikeSqlDialect.js +12 -12
- package/dist/entity/decorator/members.d.ts +4 -12
- package/dist/entity/metadata/definition.js +8 -5
- package/dist/http/handler.d.ts +6 -6
- package/dist/http/handler.js +20 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/dist/{maria → mariadb}/mariadbQuerier.js +1 -1
- package/dist/migrate/builder/columnBuilder.d.ts +3 -3
- package/dist/migrate/builder/columnBuilder.js +1 -1
- package/dist/migrate/builder/index.d.ts +0 -3
- package/dist/migrate/builder/index.js +0 -3
- package/dist/migrate/builder/migrationBuilder.d.ts +6 -6
- package/dist/migrate/builder/migrationBuilder.js +7 -7
- package/dist/migrate/builder/tableBuilder.d.ts +25 -25
- package/dist/migrate/builder/tableBuilder.js +5 -5
- package/dist/migrate/builder/types.d.ts +37 -37
- package/dist/migrate/cli-config.d.ts +11 -1
- package/dist/migrate/cli-config.js +20 -6
- package/dist/migrate/cli.js +9 -18
- package/dist/migrate/codegen/entityCodeGenerator.js +1 -1
- package/dist/migrate/codegen/migrationFile.d.ts +7 -7
- package/dist/migrate/codegen/migrationFile.js +11 -12
- package/dist/migrate/ddl/indexCapabilities.d.ts +2 -0
- package/dist/migrate/ddl/indexCapabilities.js +6 -0
- package/dist/migrate/ddl/indexDdl.d.ts +8 -0
- package/dist/migrate/ddl/indexDdl.js +22 -6
- package/dist/migrate/generator/definitionToNode.d.ts +1 -1
- package/dist/migrate/generator/definitionToNode.js +1 -1
- package/dist/migrate/index.d.ts +1 -3
- package/dist/migrate/index.js +0 -3
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +11 -15
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +13 -15
- package/dist/migrate/introspection/mssqlIntrospector.d.ts +5 -5
- package/dist/migrate/introspection/mssqlIntrospector.js +24 -28
- package/dist/migrate/introspection/mysqlIntrospector.d.ts +5 -5
- package/dist/migrate/introspection/mysqlIntrospector.js +31 -37
- package/dist/migrate/introspection/postgresIntrospector.d.ts +13 -13
- package/dist/migrate/introspection/postgresIntrospector.js +35 -39
- package/dist/migrate/introspection/registry.js +1 -1
- package/dist/migrate/introspection/sqliteIntrospector.d.ts +6 -4
- package/dist/migrate/introspection/sqliteIntrospector.js +15 -12
- package/dist/migrate/migrationLock.d.ts +38 -0
- package/dist/migrate/migrationLock.js +103 -0
- package/dist/migrate/migrationTarget.d.ts +6 -2
- package/dist/migrate/migrationTarget.js +30 -14
- package/dist/migrate/migrator.d.ts +39 -23
- package/dist/migrate/migrator.js +110 -74
- package/dist/migrate/schemaGenerator.d.ts +3 -1
- package/dist/migrate/schemaGenerator.js +14 -5
- package/dist/migrate/storage/databaseStorage.d.ts +28 -20
- package/dist/migrate/storage/databaseStorage.js +36 -54
- package/dist/migrate/storage/index.d.ts +0 -1
- package/dist/migrate/storage/index.js +0 -1
- package/dist/{mongo → mongodb}/index.d.ts +0 -1
- package/dist/{mongo → mongodb}/index.js +0 -1
- package/dist/{mongo → mongodb}/mongoCommand.d.ts +17 -1
- package/dist/{mongo → mongodb}/mongoCommand.js +15 -2
- package/dist/{mongo → mongodb}/mongoDialect.js +8 -12
- package/dist/{mongo → mongodb}/mongoIntrospector.js +12 -3
- package/dist/{mongo → mongodb}/mongoMigrationStorage.d.ts +5 -5
- package/dist/{mongo → mongodb}/mongoMigrationStorage.js +8 -12
- package/dist/{mongo → mongodb}/mongoQuerier.d.ts +3 -1
- package/dist/{mongo → mongodb}/mongoSchemaGenerator.d.ts +11 -1
- package/dist/{mongo → mongodb}/mongoSchemaGenerator.js +56 -11
- package/dist/{mongo → mongodb}/mongodbQuerier.d.ts +7 -18
- package/dist/{mongo → mongodb}/mongodbQuerier.js +44 -78
- package/dist/mssql/mssqlDialect.d.ts +6 -4
- package/dist/mssql/mssqlDialect.js +20 -10
- package/dist/mssql/mssqlQuerier.d.ts +2 -2
- package/dist/mssql/mssqlQuerier.js +3 -3
- package/dist/mssql/mssqlQuerierPool.d.ts +1 -1
- package/dist/mssql/mssqlQuerierPool.js +2 -2
- package/dist/mysql/mysql2Querier.js +1 -5
- package/dist/namingStrategy/defaultNamingStrategy.d.ts +0 -1
- package/dist/namingStrategy/defaultNamingStrategy.js +0 -3
- package/dist/pglite/pgliteDialect.d.ts +3 -0
- package/dist/pglite/pgliteDialect.js +3 -1
- package/dist/pglite/pgliteQuerier.d.ts +2 -0
- package/dist/pglite/pgliteQuerier.js +4 -0
- package/dist/postgres/postgresDialect.d.ts +3 -4
- package/dist/postgres/postgresDialect.js +5 -6
- package/dist/querier/abstractQuerier.d.ts +119 -36
- package/dist/querier/abstractQuerier.js +465 -161
- package/dist/querier/abstractQuerierPool.d.ts +5 -6
- package/dist/querier/abstractQuerierPool.js +20 -6
- package/dist/querier/abstractSqlQuerier.d.ts +15 -10
- package/dist/querier/abstractSqlQuerier.js +54 -47
- package/dist/querier/abstractSqlQuerierPool.d.ts +5 -3
- package/dist/querier/abstractSqlQuerierPool.js +7 -4
- package/dist/querier/transaction.d.ts +46 -0
- package/dist/querier/transaction.js +56 -0
- package/dist/schema/canonicalType.js +2 -2
- package/dist/schema/schemaASTDiffer.d.ts +11 -3
- package/dist/schema/schemaASTDiffer.js +20 -8
- package/dist/sqlite/nodeSqliteQuerierPool.d.ts +1 -1
- package/dist/sqlite/nodeSqliteQuerierPool.js +1 -1
- package/dist/sqlite/sqliteDialect.d.ts +1 -1
- package/dist/sqlite/sqliteDialect.js +3 -1
- package/dist/sqlite/sqliteQuerier.d.ts +2 -0
- package/dist/sqlite/sqliteQuerier.js +4 -0
- package/dist/sqlite/sqliteQuerierPool.d.ts +4 -4
- package/dist/sqlite/sqliteQuerierPool.js +1 -1
- package/dist/type/dialect.d.ts +16 -2
- package/dist/type/entity.d.ts +32 -32
- package/dist/type/migration.d.ts +10 -27
- package/dist/type/namingStrategy.d.ts +0 -4
- package/dist/type/querier.d.ts +18 -10
- package/dist/type/query.d.ts +7 -22
- package/dist/type/queryRaw.d.ts +11 -6
- package/dist/type/queryRaw.js +2 -3
- package/dist/type/universalQuerier.d.ts +26 -28
- package/dist/type/utility.d.ts +7 -2
- package/dist/util/dialect.util.d.ts +2 -2
- package/dist/util/dialect.util.js +4 -1
- package/dist/util/field.util.d.ts +12 -0
- package/dist/util/field.util.js +24 -0
- package/dist/util/hook.util.d.ts +3 -2
- package/dist/util/query.util.d.ts +5 -0
- package/dist/util/query.util.js +34 -1
- package/dist/util/raw.d.ts +8 -2
- package/dist/util/raw.js +22 -0
- package/dist/util/relationQuery.util.d.ts +2 -0
- package/dist/util/relationQuery.util.js +4 -0
- package/dist/util/sql.util.d.ts +0 -5
- package/dist/util/sql.util.js +3 -9
- package/dist/util/uqlError.d.ts +0 -6
- package/dist/util/uqlError.js +0 -5
- package/package.json +20 -26
- package/skills/uql-orm/SKILL.md +13 -10
- package/dist/migrate/storage/jsonStorage.d.ts +0 -14
- package/dist/migrate/storage/jsonStorage.js +0 -33
- /package/dist/{maria → mariadb}/index.d.ts +0 -0
- /package/dist/{maria → mariadb}/index.js +0 -0
- /package/dist/{maria → mariadb}/mariaDialect.d.ts +0 -0
- /package/dist/{maria → mariadb}/mariaDialect.js +0 -0
- /package/dist/{maria → mariadb}/mariadbQuerier.d.ts +0 -0
- /package/dist/{maria → mariadb}/mariadbQuerierPool.d.ts +0 -0
- /package/dist/{maria → mariadb}/mariadbQuerierPool.js +0 -0
- /package/dist/{mongo → mongodb}/mongoDialect.d.ts +0 -0
- /package/dist/{mongo → mongodb}/mongoIntrospector.d.ts +0 -0
- /package/dist/{mongo → mongodb}/mongoQuerier.js +0 -0
- /package/dist/{mongo → mongodb}/mongodbQuerierPool.d.ts +0 -0
- /package/dist/{mongo → mongodb}/mongodbQuerierPool.js +0 -0
- /package/dist/{mongo → mongodb}/textLanguage.d.ts +0 -0
- /package/dist/{mongo → mongodb}/textLanguage.js +0 -0
- /package/dist/{mongo → mongodb}/vectorDistance.d.ts +0 -0
- /package/dist/{mongo → mongodb}/vectorDistance.js +0 -0
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Fluent API for defining columns in migrations.
|
|
5
5
|
*/
|
|
6
6
|
import type { CanonicalType, EnumValues, ForeignKeyAction } from '../../schema/types.js';
|
|
7
|
-
import type { BaseColumnOptions, FullColumnDefinition,
|
|
7
|
+
import type { BaseColumnOptions, FullColumnDefinition, ColumnBuilder, ForeignKeyBuilder } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Builder for column definitions with a fluent API. Each call replaces the definition it holds, and `build`
|
|
10
10
|
* returns it. Columns are NOT NULL by default (safer).
|
|
11
11
|
*/
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class ColumnDefinitionBuilder implements ColumnBuilder, ForeignKeyBuilder {
|
|
13
13
|
private column;
|
|
14
14
|
constructor(name: string, type: CanonicalType, options?: BaseColumnOptions);
|
|
15
15
|
private set;
|
|
@@ -65,7 +65,7 @@ export declare class ColumnBuilder implements IColumnBuilder, IForeignKeyBuilder
|
|
|
65
65
|
* Add a foreign key reference.
|
|
66
66
|
* Returns a ForeignKeyBuilder for additional options.
|
|
67
67
|
*/
|
|
68
|
-
references(table: string, column?: string):
|
|
68
|
+
references(table: string, column?: string): ForeignKeyBuilder;
|
|
69
69
|
/**
|
|
70
70
|
* Set ON DELETE action for foreign key.
|
|
71
71
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Builder for column definitions with a fluent API. Each call replaces the definition it holds, and `build`
|
|
8
8
|
* returns it. Columns are NOT NULL by default (safer).
|
|
9
9
|
*/
|
|
10
|
-
export class
|
|
10
|
+
export class ColumnDefinitionBuilder {
|
|
11
11
|
column;
|
|
12
12
|
constructor(name, type, options = {}) {
|
|
13
13
|
const { references } = options;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { IndexColumnInput, IndexOptions } from '../../type/index.js';
|
|
2
|
-
import type { AnyMigrationOperation, ForeignKeyOptions, ForeignKeyTarget,
|
|
2
|
+
import type { AnyMigrationOperation, ForeignKeyOptions, ForeignKeyTarget, AlterTableBuilder, ColumnBuilder, ColumnFactory, MigrationBuilder, TableBuilder } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The type-safe migration builder: each change is declared once, as an operation handed to `apply`.
|
|
5
5
|
* `migrationBuilderFor` builds one running the statements its querier's generator writes for each.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class MigrationOperationBuilder implements MigrationBuilder {
|
|
8
8
|
private readonly apply;
|
|
9
9
|
constructor(apply: (operation: AnyMigrationOperation) => Promise<void>);
|
|
10
|
-
createTable(name: string, callback: (table:
|
|
10
|
+
createTable(name: string, callback: (table: TableBuilder) => void): Promise<void>;
|
|
11
11
|
dropTable(name: string, options?: {
|
|
12
12
|
ifExists?: boolean;
|
|
13
13
|
cascade?: boolean;
|
|
14
14
|
}): Promise<void>;
|
|
15
15
|
renameTable(oldName: string, newName: string): Promise<void>;
|
|
16
|
-
alterTable(name: string, callback: (table:
|
|
17
|
-
addColumn(tableName: string, callback: (columns:
|
|
16
|
+
alterTable(name: string, callback: (table: AlterTableBuilder) => void): Promise<void>;
|
|
17
|
+
addColumn(tableName: string, callback: (columns: ColumnFactory) => ColumnBuilder): Promise<void>;
|
|
18
18
|
dropColumn(tableName: string, columnName: string): Promise<void>;
|
|
19
|
-
alterColumn(tableName: string, callback: (columns:
|
|
19
|
+
alterColumn(tableName: string, callback: (columns: ColumnFactory) => ColumnBuilder): Promise<void>;
|
|
20
20
|
renameColumn(tableName: string, oldName: string, newName: string): Promise<void>;
|
|
21
21
|
createIndex(tableName: string, columns: readonly IndexColumnInput[], options?: IndexOptions): Promise<void>;
|
|
22
22
|
dropIndex(tableName: string, indexName: string): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { UqlUsageError } from '../../util/uqlError.js';
|
|
2
2
|
import { indexDefinition } from '../generator/definitionToNode.js';
|
|
3
|
-
import {
|
|
4
|
-
/** One column declared through `createTable`'s vocabulary, a throwaway {@link
|
|
3
|
+
import { TableDefinitionBuilder } from './tableBuilder.js';
|
|
4
|
+
/** One column declared through `createTable`'s vocabulary, a throwaway {@link TableDefinitionBuilder}, so its type is stated. */
|
|
5
5
|
function buildOneColumn(callback) {
|
|
6
|
-
return callback(new
|
|
6
|
+
return callback(new TableDefinitionBuilder('')).build();
|
|
7
7
|
}
|
|
8
8
|
/** The operations one `alterTable` callback declares, collected in order, since its methods are synchronous. */
|
|
9
|
-
class
|
|
9
|
+
class AlterTableOperations {
|
|
10
10
|
tableName;
|
|
11
11
|
operations = [];
|
|
12
12
|
constructor(tableName) {
|
|
@@ -83,13 +83,13 @@ class AlterTableBuilder {
|
|
|
83
83
|
* The type-safe migration builder: each change is declared once, as an operation handed to `apply`.
|
|
84
84
|
* `migrationBuilderFor` builds one running the statements its querier's generator writes for each.
|
|
85
85
|
*/
|
|
86
|
-
export class
|
|
86
|
+
export class MigrationOperationBuilder {
|
|
87
87
|
apply;
|
|
88
88
|
constructor(apply) {
|
|
89
89
|
this.apply = apply;
|
|
90
90
|
}
|
|
91
91
|
createTable(name, callback) {
|
|
92
|
-
const builder = new
|
|
92
|
+
const builder = new TableDefinitionBuilder(name);
|
|
93
93
|
callback(builder);
|
|
94
94
|
return this.apply({ type: 'createTable', table: builder.build() });
|
|
95
95
|
}
|
|
@@ -100,7 +100,7 @@ export class MigrationBuilder {
|
|
|
100
100
|
return this.apply({ type: 'renameTable', oldName, newName });
|
|
101
101
|
}
|
|
102
102
|
async alterTable(name, callback) {
|
|
103
|
-
const table = new
|
|
103
|
+
const table = new AlterTableOperations(name);
|
|
104
104
|
callback(table);
|
|
105
105
|
for (const operation of table.operations) {
|
|
106
106
|
await this.apply(operation);
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Fluent API for defining tables in migrations.
|
|
5
5
|
*/
|
|
6
6
|
import type { IndexColumnInput, IndexOptions } from '../../type/index.js';
|
|
7
|
-
import type { BaseColumnOptions, DecimalColumnOptions,
|
|
7
|
+
import type { BaseColumnOptions, DecimalColumnOptions, ColumnBuilder, TableBuilder, TableForeignKeyBuilder, StringColumnOptions, TableDefinition, VectorColumnOptions } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Builder for table definitions with a fluent API.
|
|
10
10
|
*/
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class TableDefinitionBuilder implements TableBuilder {
|
|
12
12
|
private _name;
|
|
13
13
|
private _columnBuilders;
|
|
14
14
|
private _primaryKey?;
|
|
@@ -17,36 +17,36 @@ export declare class TableBuilder implements ITableBuilder {
|
|
|
17
17
|
private _comment?;
|
|
18
18
|
constructor(name: string);
|
|
19
19
|
/** Big, matching an entity's `@Id`: a key is spelled from this type, so it has to state the real one. */
|
|
20
|
-
id(name?: string, options?: BaseColumnOptions):
|
|
21
|
-
integer(name: string, options?: BaseColumnOptions):
|
|
22
|
-
smallint(name: string, options?: BaseColumnOptions):
|
|
23
|
-
bigint(name: string, options?: BaseColumnOptions):
|
|
24
|
-
float(name: string, options?: BaseColumnOptions):
|
|
25
|
-
double(name: string, options?: BaseColumnOptions):
|
|
26
|
-
decimal(name: string, options?: DecimalColumnOptions):
|
|
27
|
-
string(name: string, options?: StringColumnOptions):
|
|
28
|
-
char(name: string, options?: StringColumnOptions):
|
|
29
|
-
text(name: string, options?: BaseColumnOptions):
|
|
30
|
-
boolean(name: string, options?: BaseColumnOptions):
|
|
31
|
-
date(name: string, options?: BaseColumnOptions):
|
|
32
|
-
time(name: string, options?: BaseColumnOptions):
|
|
33
|
-
timestamp(name: string, options?: BaseColumnOptions):
|
|
34
|
-
timestamptz(name: string, options?: BaseColumnOptions):
|
|
35
|
-
json(name: string, options?: BaseColumnOptions):
|
|
20
|
+
id(name?: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
21
|
+
integer(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
22
|
+
smallint(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
23
|
+
bigint(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
24
|
+
float(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
25
|
+
double(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
26
|
+
decimal(name: string, options?: DecimalColumnOptions): ColumnBuilder;
|
|
27
|
+
string(name: string, options?: StringColumnOptions): ColumnBuilder;
|
|
28
|
+
char(name: string, options?: StringColumnOptions): ColumnBuilder;
|
|
29
|
+
text(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
30
|
+
boolean(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
31
|
+
date(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
32
|
+
time(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
33
|
+
timestamp(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
34
|
+
timestamptz(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
35
|
+
json(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
36
36
|
/** One canonical json category; the dialect decides between `JSON` and `JSONB`. */
|
|
37
|
-
jsonb(name: string, options?: BaseColumnOptions):
|
|
38
|
-
uuid(name: string, options?: BaseColumnOptions):
|
|
39
|
-
blob(name: string, options?: BaseColumnOptions):
|
|
40
|
-
vector(name: string, options?: VectorColumnOptions):
|
|
37
|
+
jsonb(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
38
|
+
uuid(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
39
|
+
blob(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
40
|
+
vector(name: string, options?: VectorColumnOptions): ColumnBuilder;
|
|
41
41
|
private add;
|
|
42
|
-
createdAt():
|
|
43
|
-
updatedAt():
|
|
42
|
+
createdAt(): ColumnBuilder;
|
|
43
|
+
updatedAt(): ColumnBuilder;
|
|
44
44
|
private timestampNow;
|
|
45
45
|
timestamps(): void;
|
|
46
46
|
primaryKey(columns: string[]): this;
|
|
47
47
|
unique(columns: readonly IndexColumnInput[], options?: string | IndexOptions): this;
|
|
48
48
|
index(columns: readonly IndexColumnInput[], options?: string | IndexOptions): this;
|
|
49
|
-
foreignKey(columns: string[]):
|
|
49
|
+
foreignKey(columns: string[]): TableForeignKeyBuilder;
|
|
50
50
|
comment(text: string): this;
|
|
51
51
|
/**
|
|
52
52
|
* Build the table definition.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { DATE_PRECISION } from '../../util/date.js';
|
|
7
7
|
import { currentTimestamp } from '../../util/raw.js';
|
|
8
8
|
import { columnForeignKey, columnIndex, indexDefinition } from '../generator/definitionToNode.js';
|
|
9
|
-
import {
|
|
9
|
+
import { ColumnDefinitionBuilder } from './columnBuilder.js';
|
|
10
10
|
/** Normalizes `table.index` options, where a bare string is the index name. */
|
|
11
11
|
function namedOptions(options) {
|
|
12
12
|
return typeof options === 'string' ? { name: options } : (options ?? {});
|
|
@@ -14,7 +14,7 @@ function namedOptions(options) {
|
|
|
14
14
|
/**
|
|
15
15
|
* Builder for table-level foreign keys.
|
|
16
16
|
*/
|
|
17
|
-
class
|
|
17
|
+
class TableForeignKeyDefinitionBuilder {
|
|
18
18
|
_columns;
|
|
19
19
|
_referencedTable;
|
|
20
20
|
_referencedColumns = [];
|
|
@@ -59,7 +59,7 @@ class TableForeignKeyBuilder {
|
|
|
59
59
|
/**
|
|
60
60
|
* Builder for table definitions with a fluent API.
|
|
61
61
|
*/
|
|
62
|
-
export class
|
|
62
|
+
export class TableDefinitionBuilder {
|
|
63
63
|
_name;
|
|
64
64
|
_columnBuilders = [];
|
|
65
65
|
_primaryKey;
|
|
@@ -136,7 +136,7 @@ export class TableBuilder {
|
|
|
136
136
|
return this.add(name, { category: 'vector', length: dimensions }, rest);
|
|
137
137
|
}
|
|
138
138
|
add(name, type, options = {}) {
|
|
139
|
-
const column = new
|
|
139
|
+
const column = new ColumnDefinitionBuilder(name, type, options);
|
|
140
140
|
this._columnBuilders.push(column);
|
|
141
141
|
return column;
|
|
142
142
|
}
|
|
@@ -166,7 +166,7 @@ export class TableBuilder {
|
|
|
166
166
|
return this;
|
|
167
167
|
}
|
|
168
168
|
foreignKey(columns) {
|
|
169
|
-
const fk = new
|
|
169
|
+
const fk = new TableForeignKeyDefinitionBuilder(columns);
|
|
170
170
|
this._foreignKeyBuilders.push(fk);
|
|
171
171
|
return fk;
|
|
172
172
|
}
|
|
@@ -168,7 +168,7 @@ export type ForeignKeyOptions = Pick<ForeignKeySchema, 'name' | 'onDelete' | 'on
|
|
|
168
168
|
/**
|
|
169
169
|
* Interface for column builder (fluent API).
|
|
170
170
|
*/
|
|
171
|
-
export interface
|
|
171
|
+
export interface ColumnBuilder {
|
|
172
172
|
/** Make column nullable */
|
|
173
173
|
nullable(value?: boolean): this;
|
|
174
174
|
/** Make column NOT NULL (convenience method) */
|
|
@@ -192,70 +192,70 @@ export interface IColumnBuilder {
|
|
|
192
192
|
/** Set as unsigned (MySQL/MariaDB) */
|
|
193
193
|
unsigned(): this;
|
|
194
194
|
/** Add foreign key reference */
|
|
195
|
-
references(table: string, column?: string):
|
|
195
|
+
references(table: string, column?: string): ForeignKeyBuilder;
|
|
196
196
|
/** Get the built column definition */
|
|
197
197
|
build(): FullColumnDefinition;
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
200
200
|
* Interface for foreign key builder.
|
|
201
201
|
*/
|
|
202
|
-
export interface
|
|
202
|
+
export interface ForeignKeyBuilder extends ColumnBuilder {
|
|
203
203
|
/** Set ON DELETE action */
|
|
204
204
|
onDelete(action: ForeignKeyAction): this;
|
|
205
205
|
/** Set ON UPDATE action */
|
|
206
206
|
onUpdate(action: ForeignKeyAction): this;
|
|
207
207
|
}
|
|
208
208
|
/** Every column type the builder can declare, name first, handed to `addColumn`/`alterColumn` callbacks too. */
|
|
209
|
-
export interface
|
|
209
|
+
export interface ColumnFactory {
|
|
210
210
|
/** Add an auto-incrementing primary key */
|
|
211
|
-
id(name?: string, options?: BaseColumnOptions):
|
|
211
|
+
id(name?: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
212
212
|
/** Add an integer column */
|
|
213
|
-
integer(name: string, options?: BaseColumnOptions):
|
|
213
|
+
integer(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
214
214
|
/** Add a smallint column */
|
|
215
|
-
smallint(name: string, options?: BaseColumnOptions):
|
|
215
|
+
smallint(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
216
216
|
/** Add a bigint column */
|
|
217
|
-
bigint(name: string, options?: BaseColumnOptions):
|
|
217
|
+
bigint(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
218
218
|
/** Add a float column */
|
|
219
|
-
float(name: string, options?: BaseColumnOptions):
|
|
219
|
+
float(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
220
220
|
/** Add a double column */
|
|
221
|
-
double(name: string, options?: BaseColumnOptions):
|
|
221
|
+
double(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
222
222
|
/** Add a decimal column */
|
|
223
|
-
decimal(name: string, options?: DecimalColumnOptions):
|
|
223
|
+
decimal(name: string, options?: DecimalColumnOptions): ColumnBuilder;
|
|
224
224
|
/** Add a varchar column */
|
|
225
|
-
string(name: string, options?: StringColumnOptions):
|
|
225
|
+
string(name: string, options?: StringColumnOptions): ColumnBuilder;
|
|
226
226
|
/** Add a char column */
|
|
227
|
-
char(name: string, options?: StringColumnOptions):
|
|
227
|
+
char(name: string, options?: StringColumnOptions): ColumnBuilder;
|
|
228
228
|
/** Add a text column */
|
|
229
|
-
text(name: string, options?: BaseColumnOptions):
|
|
229
|
+
text(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
230
230
|
/** Add a boolean column */
|
|
231
|
-
boolean(name: string, options?: BaseColumnOptions):
|
|
231
|
+
boolean(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
232
232
|
/** Add a date column */
|
|
233
|
-
date(name: string, options?: BaseColumnOptions):
|
|
233
|
+
date(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
234
234
|
/** Add a time column */
|
|
235
|
-
time(name: string, options?: BaseColumnOptions):
|
|
235
|
+
time(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
236
236
|
/** Add a timestamp column */
|
|
237
|
-
timestamp(name: string, options?: BaseColumnOptions):
|
|
237
|
+
timestamp(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
238
238
|
/** Add a timestamptz column */
|
|
239
|
-
timestamptz(name: string, options?: BaseColumnOptions):
|
|
239
|
+
timestamptz(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
240
240
|
/** Add a JSON column */
|
|
241
|
-
json(name: string, options?: BaseColumnOptions):
|
|
241
|
+
json(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
242
242
|
/** Add a JSONB column (Postgres) */
|
|
243
|
-
jsonb(name: string, options?: BaseColumnOptions):
|
|
243
|
+
jsonb(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
244
244
|
/** Add a UUID column */
|
|
245
|
-
uuid(name: string, options?: BaseColumnOptions):
|
|
245
|
+
uuid(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
246
246
|
/** Add a blob/bytea column */
|
|
247
|
-
blob(name: string, options?: BaseColumnOptions):
|
|
247
|
+
blob(name: string, options?: BaseColumnOptions): ColumnBuilder;
|
|
248
248
|
/** Add a vector column (for embeddings) */
|
|
249
|
-
vector(name: string, options?: VectorColumnOptions):
|
|
249
|
+
vector(name: string, options?: VectorColumnOptions): ColumnBuilder;
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Interface for table builder (fluent API).
|
|
253
253
|
*/
|
|
254
|
-
export interface
|
|
254
|
+
export interface TableBuilder extends ColumnFactory {
|
|
255
255
|
/** Add createdAt timestamp column */
|
|
256
|
-
createdAt():
|
|
256
|
+
createdAt(): ColumnBuilder;
|
|
257
257
|
/** Add updatedAt timestamp column */
|
|
258
|
-
updatedAt():
|
|
258
|
+
updatedAt(): ColumnBuilder;
|
|
259
259
|
/** Add both createdAt and updatedAt columns */
|
|
260
260
|
timestamps(): void;
|
|
261
261
|
/** Add composite primary key */
|
|
@@ -265,7 +265,7 @@ export interface ITableBuilder extends IColumnFactory {
|
|
|
265
265
|
/** Add a composite index; takes the same options as `@Index`, or just its name. */
|
|
266
266
|
index(columns: readonly IndexColumnInput[], options?: string | IndexOptions): this;
|
|
267
267
|
/** Add table-level foreign key */
|
|
268
|
-
foreignKey(columns: string[]):
|
|
268
|
+
foreignKey(columns: string[]): TableForeignKeyBuilder;
|
|
269
269
|
/** Add a comment to the table */
|
|
270
270
|
comment(text: string): this;
|
|
271
271
|
/** Get the built table definition */
|
|
@@ -274,7 +274,7 @@ export interface ITableBuilder extends IColumnFactory {
|
|
|
274
274
|
/**
|
|
275
275
|
* Interface for table-level foreign key builder.
|
|
276
276
|
*/
|
|
277
|
-
export interface
|
|
277
|
+
export interface TableForeignKeyBuilder {
|
|
278
278
|
/** Reference target table and columns */
|
|
279
279
|
references(table: string, columns: string[]): this;
|
|
280
280
|
/** Set ON DELETE action */
|
|
@@ -287,15 +287,15 @@ export interface ITableForeignKeyBuilder {
|
|
|
287
287
|
/**
|
|
288
288
|
* Interface for altering a table.
|
|
289
289
|
*/
|
|
290
|
-
export interface
|
|
290
|
+
export interface AlterTableBuilder {
|
|
291
291
|
/** Add a column, declared exactly as in `createTable`: `addColumn((c) => c.timestamp('createdAt'))`. */
|
|
292
|
-
addColumn(callback: (columns:
|
|
292
|
+
addColumn(callback: (columns: ColumnFactory) => ColumnBuilder): this;
|
|
293
293
|
/** Drop a column from the table */
|
|
294
294
|
dropColumn(name: string): this;
|
|
295
295
|
/** Rename a column */
|
|
296
296
|
renameColumn(oldName: string, newName: string): this;
|
|
297
297
|
/** Redeclare a column, named and typed as it should end up. */
|
|
298
|
-
alterColumn(callback: (columns:
|
|
298
|
+
alterColumn(callback: (columns: ColumnFactory) => ColumnBuilder): this;
|
|
299
299
|
/** Add an index to the table */
|
|
300
300
|
addIndex(columns: readonly IndexColumnInput[], options?: IndexOptions): this;
|
|
301
301
|
/** Drop an index from the table */
|
|
@@ -308,9 +308,9 @@ export interface IAlterTableBuilder {
|
|
|
308
308
|
/**
|
|
309
309
|
* Interface for the main migration builder.
|
|
310
310
|
*/
|
|
311
|
-
export interface
|
|
311
|
+
export interface MigrationBuilder {
|
|
312
312
|
/** Create a table as `callback` declares it; on MongoDB a collection, whose callback declares only indexes. */
|
|
313
|
-
createTable(name: string, callback: (table:
|
|
313
|
+
createTable(name: string, callback: (table: TableBuilder) => void): Promise<void>;
|
|
314
314
|
/** Drop a table */
|
|
315
315
|
dropTable(name: string, options?: {
|
|
316
316
|
ifExists?: boolean;
|
|
@@ -319,13 +319,13 @@ export interface IMigrationBuilder {
|
|
|
319
319
|
/** Rename a table */
|
|
320
320
|
renameTable(oldName: string, newName: string): Promise<void>;
|
|
321
321
|
/** Alter an existing table */
|
|
322
|
-
alterTable(name: string, callback: (table:
|
|
322
|
+
alterTable(name: string, callback: (table: AlterTableBuilder) => void): Promise<void>;
|
|
323
323
|
/** Add a column, declared exactly as in `createTable`: `addColumn('t', (c) => c.timestamp('at'))`. */
|
|
324
|
-
addColumn(tableName: string, callback: (columns:
|
|
324
|
+
addColumn(tableName: string, callback: (columns: ColumnFactory) => ColumnBuilder): Promise<void>;
|
|
325
325
|
/** Drop a column from a table */
|
|
326
326
|
dropColumn(tableName: string, columnName: string): Promise<void>;
|
|
327
327
|
/** Redeclare a column, named and typed as it should end up. */
|
|
328
|
-
alterColumn(tableName: string, callback: (columns:
|
|
328
|
+
alterColumn(tableName: string, callback: (columns: ColumnFactory) => ColumnBuilder): Promise<void>;
|
|
329
329
|
/** Rename a column */
|
|
330
330
|
renameColumn(tableName: string, oldName: string, newName: string): Promise<void>;
|
|
331
331
|
/** Create an index; takes the same options as `@Index`, so a generated migration can restate them. */
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { Config } from '../type/index.js';
|
|
2
|
+
import { UqlUsageError } from '../util/uqlError.js';
|
|
2
3
|
/**
|
|
3
4
|
* The project's own `tsx/esm/api` where Node must load a TypeScript config: Node's type stripping runs
|
|
4
5
|
* no decorators, and Bun and Deno transform them natively. uql bundles no transpiler, so the project's
|
|
5
|
-
* loader reads the project's `tsconfig.json`.
|
|
6
|
+
* loader reads the project's `tsconfig.json`. Registered for the process, never imported through: an
|
|
7
|
+
* import of its own would load the config's `uql-orm` apart from the CLI's, whose objects the other misreads.
|
|
6
8
|
*/
|
|
7
9
|
export declare function tsxApiFor(path: string, versions: {
|
|
8
10
|
bun?: string;
|
|
9
11
|
deno?: string;
|
|
10
12
|
}): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Why `path` failed to import. Only plain Node, which strips types without running decorators, can fail on
|
|
15
|
+
* those, so only there does it point at a runtime that runs them: Bun, Deno, or the project's tsx.
|
|
16
|
+
*/
|
|
17
|
+
export declare function importFailure(path: string, cause: unknown, versions: {
|
|
18
|
+
bun?: string;
|
|
19
|
+
deno?: string;
|
|
20
|
+
}, tsxApi: string | undefined): UqlUsageError;
|
|
11
21
|
/** The config at `customPath`, or the first of {@link CONFIG_FILES} in the working directory; the CLI validates it. */
|
|
12
22
|
export declare function loadConfig(customPath?: string): Promise<Config>;
|
|
@@ -6,7 +6,8 @@ import { UqlUsageError } from '../util/uqlError.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* The project's own `tsx/esm/api` where Node must load a TypeScript config: Node's type stripping runs
|
|
8
8
|
* no decorators, and Bun and Deno transform them natively. uql bundles no transpiler, so the project's
|
|
9
|
-
* loader reads the project's `tsconfig.json`.
|
|
9
|
+
* loader reads the project's `tsconfig.json`. Registered for the process, never imported through: an
|
|
10
|
+
* import of its own would load the config's `uql-orm` apart from the CLI's, whose objects the other misreads.
|
|
10
11
|
*/
|
|
11
12
|
export function tsxApiFor(path, versions) {
|
|
12
13
|
if (!/\.[mc]?ts$/.test(path) || versions.bun || versions.deno) {
|
|
@@ -23,16 +24,29 @@ async function importConfig(path) {
|
|
|
23
24
|
const url = pathToFileURL(path).href;
|
|
24
25
|
const tsxApi = tsxApiFor(path, process.versions);
|
|
25
26
|
const loading = tsxApi
|
|
26
|
-
? import(pathToFileURL(tsxApi).href).then((api) =>
|
|
27
|
+
? import(pathToFileURL(tsxApi).href).then((api) => {
|
|
28
|
+
api.register();
|
|
29
|
+
return import(url);
|
|
30
|
+
})
|
|
27
31
|
: import(url);
|
|
28
32
|
const mod = await loading.catch((cause) => {
|
|
29
|
-
throw
|
|
30
|
-
'If it reaches entity classes, their decorators need a runtime that transforms TypeScript, not ' +
|
|
31
|
-
'just one that strips its types. Run the CLI with `bun`, or install tsx (`npm i -D tsx`), which the ' +
|
|
32
|
-
'CLI uses when it finds one. See https://uql-orm.dev/migrations#running-the-cli', { cause });
|
|
33
|
+
throw importFailure(path, cause, process.versions, tsxApi);
|
|
33
34
|
});
|
|
34
35
|
return mod.default ?? mod;
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Why `path` failed to import. Only plain Node, which strips types without running decorators, can fail on
|
|
39
|
+
* those, so only there does it point at a runtime that runs them: Bun, Deno, or the project's tsx.
|
|
40
|
+
*/
|
|
41
|
+
export function importFailure(path, cause, versions, tsxApi) {
|
|
42
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
43
|
+
const hint = tsxApi || versions.bun || versions.deno
|
|
44
|
+
? ''
|
|
45
|
+
: '\nIf it reaches entity classes, their decorators need a runtime that transforms TypeScript, not ' +
|
|
46
|
+
'just one that strips its types. Run the CLI with `bun`, or install tsx (`npm i -D tsx`), which the ' +
|
|
47
|
+
'CLI uses when it finds one. See https://uql-orm.dev/migrations#running-the-cli';
|
|
48
|
+
return new UqlUsageError(`Could not import ${path}: ${message}${hint}`, { cause });
|
|
49
|
+
}
|
|
36
50
|
/** Where the CLI looks for its config, in order, when it is given no path. */
|
|
37
51
|
const CONFIG_FILES = ['uql.config.ts', 'uql.config.js', 'uql.config.mjs', '.uqlrc.ts', '.uqlrc.js'];
|
|
38
52
|
/** The config at `customPath`, or the first of {@link CONFIG_FILES} in the working directory; the CLI validates it. */
|
package/dist/migrate/cli.js
CHANGED
|
@@ -39,12 +39,11 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
39
39
|
const rest = filteredArgs.slice(1);
|
|
40
40
|
switch (command) {
|
|
41
41
|
case 'up':
|
|
42
|
-
reportRun(await migrator.up({ to: readFlag(rest, '--to'), step: readStep(rest) }), 'Migrations', 'No pending migrations.');
|
|
42
|
+
reportRun(await migrator.up({ to: readFlag(rest, '--to'), step: readStep(rest) }), 'Migrations', 'applied', 'No pending migrations.');
|
|
43
43
|
break;
|
|
44
44
|
case 'down': {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
reportRun(await migrator.down({ to, step }), 'Rollback', 'No migrations to rollback.');
|
|
45
|
+
const step = rest.includes('--all') ? Infinity : readStep(rest);
|
|
46
|
+
reportRun(await migrator.down({ to: readFlag(rest, '--to'), step }), 'Rollback', 'reverted', 'No migrations to rollback.');
|
|
48
47
|
break;
|
|
49
48
|
}
|
|
50
49
|
case 'status': {
|
|
@@ -53,7 +52,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
53
52
|
break;
|
|
54
53
|
}
|
|
55
54
|
case 'pending': {
|
|
56
|
-
const pending = await migrator.
|
|
55
|
+
const { pending } = await migrator.status();
|
|
57
56
|
print(...(pending.length ? ['Pending migrations:', ...listed(pending, '○')] : ['No pending migrations.']));
|
|
58
57
|
break;
|
|
59
58
|
}
|
|
@@ -101,17 +100,9 @@ function readStep(args) {
|
|
|
101
100
|
const step = readFlag(args, '--step');
|
|
102
101
|
return step === undefined ? undefined : Number.parseInt(step, 10);
|
|
103
102
|
}
|
|
104
|
-
/** How a
|
|
105
|
-
function reportRun(results, title, none) {
|
|
106
|
-
|
|
107
|
-
console.log(none);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const failed = results.filter((result) => !result.success).length;
|
|
111
|
-
console.log(`\n${title} complete: ${results.length - failed} successful, ${failed} failed`);
|
|
112
|
-
if (failed) {
|
|
113
|
-
process.exit(1);
|
|
114
|
-
}
|
|
103
|
+
/** How many migrations ran; a failed one threw, which exits the process. */
|
|
104
|
+
function reportRun(results, title, verb, none) {
|
|
105
|
+
console.log(results.length ? `\n${title} complete: ${results.length} ${verb}.` : none);
|
|
115
106
|
}
|
|
116
107
|
/** Migration names, one a line, or `(none)`. */
|
|
117
108
|
function listed(names, icon) {
|
|
@@ -184,9 +175,9 @@ export async function runDriftCheck(migrator, config) {
|
|
|
184
175
|
else {
|
|
185
176
|
console.log('\nChecking for schema drift...');
|
|
186
177
|
const generator = await migrator.getSchemaGenerator();
|
|
187
|
-
// MongoDB's generator builds no AST: a collection has only its indexes to compare, which a dry run lists.
|
|
178
|
+
// MongoDB's generator builds no AST: a collection has only its indexes and validator to compare, which a dry run lists.
|
|
188
179
|
if (!generator.buildAST) {
|
|
189
|
-
throw new UqlUsageError('drift:check compares tables, and this database has none: `sync --dry-run` prints the index changes a sync would make');
|
|
180
|
+
throw new UqlUsageError('drift:check compares tables, and this database has none: `sync --dry-run` prints the index and validator changes a sync would make');
|
|
190
181
|
}
|
|
191
182
|
const expectedAST = generator.buildAST(config.entities);
|
|
192
183
|
// Build actual schema from database
|
|
@@ -243,7 +243,7 @@ function formatTypeDescription(type) {
|
|
|
243
243
|
* `!`, which an insert leaves out anyway), `| null` where it holds NULL, `readonly` where the database computes it.
|
|
244
244
|
*/
|
|
245
245
|
function propertySource(col, propertyName) {
|
|
246
|
-
const type = col.type.category === 'json' ? 'Json
|
|
246
|
+
const type = col.type.category === 'json' ? 'Json' : canonicalToTypeScript(col.type);
|
|
247
247
|
const written = col.generatedAs === undefined ? '' : 'readonly ';
|
|
248
248
|
if (col.nullable && !col.isPrimaryKey) {
|
|
249
249
|
return `${written}${propertyName}?: ${type} | null`;
|
|
@@ -13,19 +13,19 @@ export type MigrationModuleOptions = {
|
|
|
13
13
|
downInner: string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* One `await querier.run`...`` line, the SQL a template binding nothing, so its lines and quotes read as
|
|
17
|
+
* written; a backslash, a backtick and a `${` are escaped.
|
|
18
18
|
*/
|
|
19
19
|
export declare function emitSqlRunCall(sql: string): string;
|
|
20
|
-
/** Indented `up`/`down` body: one `await querier.run
|
|
20
|
+
/** Indented `up`/`down` body: one `await querier.run`...`` per SQL string. */
|
|
21
21
|
export declare function emitSqlRunCalls(statements: string[]): string;
|
|
22
22
|
/** Indented `up`/`down` body: one awaited driver call on `querier.db` per MongoDB command. */
|
|
23
23
|
export declare function emitMongoCommandCalls(statements: string[]): string;
|
|
24
24
|
/** How a migration on one querier is scaffolded empty, and how a generated statement is spelled in it. */
|
|
25
25
|
export type MigrationSource = {
|
|
26
26
|
readonly querier: MigrationQuerierType;
|
|
27
|
-
/** The entry
|
|
28
|
-
readonly
|
|
27
|
+
/** The entry the querier type is imported from: only `uql-orm/mongodb` names the driver's `Db`. */
|
|
28
|
+
readonly entry: string;
|
|
29
29
|
readonly emptyUp: string;
|
|
30
30
|
readonly emptyDown: string;
|
|
31
31
|
emit(statements: string[]): string;
|
|
@@ -33,14 +33,14 @@ export type MigrationSource = {
|
|
|
33
33
|
export declare const migrationSource: {
|
|
34
34
|
SqlQuerier: {
|
|
35
35
|
querier: "SqlQuerier";
|
|
36
|
-
|
|
36
|
+
entry: string;
|
|
37
37
|
emptyUp: string;
|
|
38
38
|
emptyDown: string;
|
|
39
39
|
emit: typeof emitSqlRunCalls;
|
|
40
40
|
};
|
|
41
41
|
MongoQuerier: {
|
|
42
42
|
querier: "MongoQuerier";
|
|
43
|
-
|
|
43
|
+
entry: string;
|
|
44
44
|
emptyUp: string;
|
|
45
45
|
emptyDown: string;
|
|
46
46
|
emit: typeof emitMongoCommandCalls;
|