@mikro-orm/sql 7.0.4-dev.9 → 7.0.4
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/AbstractSqlConnection.d.ts +94 -58
- package/AbstractSqlConnection.js +235 -238
- package/AbstractSqlDriver.d.ts +410 -155
- package/AbstractSqlDriver.js +2064 -1941
- package/AbstractSqlPlatform.d.ts +83 -73
- package/AbstractSqlPlatform.js +162 -158
- package/PivotCollectionPersister.d.ts +33 -15
- package/PivotCollectionPersister.js +158 -160
- package/README.md +1 -1
- package/SqlEntityManager.d.ts +67 -22
- package/SqlEntityManager.js +54 -38
- package/SqlEntityRepository.d.ts +14 -14
- package/SqlEntityRepository.js +23 -23
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -12
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +192 -194
- package/dialects/mysql/BaseMySqlPlatform.d.ts +64 -45
- package/dialects/mysql/BaseMySqlPlatform.js +134 -131
- package/dialects/mysql/MySqlExceptionConverter.d.ts +6 -6
- package/dialects/mysql/MySqlExceptionConverter.js +91 -77
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +3 -3
- package/dialects/mysql/MySqlNativeQueryBuilder.js +66 -69
- package/dialects/mysql/MySqlSchemaHelper.d.ts +39 -39
- package/dialects/mysql/MySqlSchemaHelper.js +327 -319
- package/dialects/oracledb/OracleDialect.d.ts +81 -52
- package/dialects/oracledb/OracleDialect.js +155 -149
- package/dialects/oracledb/OracleNativeQueryBuilder.d.ts +12 -12
- package/dialects/oracledb/OracleNativeQueryBuilder.js +232 -236
- package/dialects/postgresql/BasePostgreSqlPlatform.d.ts +109 -105
- package/dialects/postgresql/BasePostgreSqlPlatform.js +354 -350
- package/dialects/postgresql/FullTextType.d.ts +10 -6
- package/dialects/postgresql/FullTextType.js +51 -51
- package/dialects/postgresql/PostgreSqlExceptionConverter.d.ts +5 -5
- package/dialects/postgresql/PostgreSqlExceptionConverter.js +55 -43
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +4 -4
- package/dialects/postgresql/PostgreSqlSchemaHelper.d.ts +102 -82
- package/dialects/postgresql/PostgreSqlSchemaHelper.js +733 -705
- package/dialects/sqlite/BaseSqliteConnection.d.ts +3 -5
- package/dialects/sqlite/BaseSqliteConnection.js +21 -19
- package/dialects/sqlite/NodeSqliteDialect.d.ts +1 -1
- package/dialects/sqlite/NodeSqliteDialect.js +23 -23
- package/dialects/sqlite/SqliteDriver.d.ts +1 -1
- package/dialects/sqlite/SqliteDriver.js +3 -3
- package/dialects/sqlite/SqliteExceptionConverter.d.ts +6 -6
- package/dialects/sqlite/SqliteExceptionConverter.js +67 -51
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +2 -2
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +7 -7
- package/dialects/sqlite/SqlitePlatform.d.ts +63 -72
- package/dialects/sqlite/SqlitePlatform.js +139 -139
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +70 -60
- package/dialects/sqlite/SqliteSchemaHelper.js +533 -520
- package/package.json +3 -3
- package/plugin/index.d.ts +42 -35
- package/plugin/index.js +43 -36
- package/plugin/transformer.d.ts +117 -94
- package/plugin/transformer.js +890 -881
- package/query/ArrayCriteriaNode.d.ts +4 -4
- package/query/ArrayCriteriaNode.js +18 -18
- package/query/CriteriaNode.d.ts +35 -25
- package/query/CriteriaNode.js +133 -123
- package/query/CriteriaNodeFactory.d.ts +49 -6
- package/query/CriteriaNodeFactory.js +97 -94
- package/query/NativeQueryBuilder.d.ts +118 -118
- package/query/NativeQueryBuilder.js +484 -480
- package/query/ObjectCriteriaNode.d.ts +12 -12
- package/query/ObjectCriteriaNode.js +298 -282
- package/query/QueryBuilder.d.ts +1557 -905
- package/query/QueryBuilder.js +2322 -2192
- package/query/QueryBuilderHelper.d.ts +153 -72
- package/query/QueryBuilderHelper.js +1079 -1028
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +53 -46
- package/query/enums.d.ts +14 -14
- package/query/enums.js +14 -14
- package/query/raw.d.ts +16 -6
- package/query/raw.js +10 -10
- package/schema/DatabaseSchema.d.ts +73 -50
- package/schema/DatabaseSchema.js +331 -307
- package/schema/DatabaseTable.d.ts +96 -73
- package/schema/DatabaseTable.js +1012 -927
- package/schema/SchemaComparator.d.ts +70 -66
- package/schema/SchemaComparator.js +766 -740
- package/schema/SchemaHelper.d.ts +109 -95
- package/schema/SchemaHelper.js +675 -659
- package/schema/SqlSchemaGenerator.d.ts +78 -58
- package/schema/SqlSchemaGenerator.js +535 -501
- package/typings.d.ts +380 -266
package/schema/SchemaHelper.d.ts
CHANGED
|
@@ -6,99 +6,113 @@ import type { DatabaseSchema } from './DatabaseSchema.js';
|
|
|
6
6
|
import type { DatabaseTable } from './DatabaseTable.js';
|
|
7
7
|
/** Base class for database-specific schema helpers. Provides SQL generation for DDL operations. */
|
|
8
8
|
export declare abstract class SchemaHelper {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
9
|
+
protected readonly platform: AbstractSqlPlatform;
|
|
10
|
+
constructor(platform: AbstractSqlPlatform);
|
|
11
|
+
/** Returns SQL to prepend to schema migration scripts (e.g., disabling FK checks). */
|
|
12
|
+
getSchemaBeginning(_charset: string, disableForeignKeys?: boolean): string;
|
|
13
|
+
/** Returns SQL to disable foreign key checks. */
|
|
14
|
+
disableForeignKeysSQL(): string;
|
|
15
|
+
/** Returns SQL to re-enable foreign key checks. */
|
|
16
|
+
enableForeignKeysSQL(): string;
|
|
17
|
+
/** Returns SQL to append to schema migration scripts (e.g., re-enabling FK checks). */
|
|
18
|
+
getSchemaEnd(disableForeignKeys?: boolean): string;
|
|
19
|
+
finalizeTable(table: DatabaseTable, charset: string, collate?: string): string;
|
|
20
|
+
appendComments(table: DatabaseTable): string[];
|
|
21
|
+
supportsSchemaConstraints(): boolean;
|
|
22
|
+
getPrimaryKeys(
|
|
23
|
+
connection: AbstractSqlConnection,
|
|
24
|
+
indexes: IndexDef[] | undefined,
|
|
25
|
+
tableName: string,
|
|
26
|
+
schemaName?: string,
|
|
27
|
+
): Promise<string[]>;
|
|
28
|
+
inferLengthFromColumnType(type: string): number | undefined;
|
|
29
|
+
protected getTableKey(t: Table): string;
|
|
30
|
+
getCreateNativeEnumSQL(name: string, values: unknown[], schema?: string): string;
|
|
31
|
+
getDropNativeEnumSQL(name: string, schema?: string): string;
|
|
32
|
+
getAlterNativeEnumSQL(name: string, schema?: string, value?: string, items?: string[], oldItems?: string[]): string;
|
|
33
|
+
/** Loads table metadata (columns, indexes, foreign keys) from the database information schema. */
|
|
34
|
+
abstract loadInformationSchema(
|
|
35
|
+
schema: DatabaseSchema,
|
|
36
|
+
connection: AbstractSqlConnection,
|
|
37
|
+
tables: Table[],
|
|
38
|
+
schemas?: string[],
|
|
39
|
+
): Promise<void>;
|
|
40
|
+
/** Returns the SQL query to list all tables in the database. */
|
|
41
|
+
getListTablesSQL(): string;
|
|
42
|
+
/** Retrieves all tables from the database. */
|
|
43
|
+
getAllTables(connection: AbstractSqlConnection, schemas?: string[]): Promise<Table[]>;
|
|
44
|
+
getListViewsSQL(): string;
|
|
45
|
+
loadViews(schema: DatabaseSchema, connection: AbstractSqlConnection, schemaName?: string): Promise<void>;
|
|
46
|
+
/** Returns SQL to rename a column in a table. */
|
|
47
|
+
getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column, schemaName?: string): string;
|
|
48
|
+
/** Returns SQL to create an index on a table. */
|
|
49
|
+
getCreateIndexSQL(tableName: string, index: IndexDef): string;
|
|
50
|
+
/**
|
|
51
|
+
* Hook for adding driver-specific index options (e.g., fill factor for PostgreSQL).
|
|
52
|
+
*/
|
|
53
|
+
protected getCreateIndexSuffix(_index: IndexDef): string;
|
|
54
|
+
/**
|
|
55
|
+
* Build the column list for an index, supporting advanced options like sort order, nulls ordering, and collation.
|
|
56
|
+
* Note: Prefix length is only supported by MySQL/MariaDB which override this method.
|
|
57
|
+
*/
|
|
58
|
+
protected getIndexColumns(index: IndexDef): string;
|
|
59
|
+
/** Returns SQL to drop an index. */
|
|
60
|
+
getDropIndexSQL(tableName: string, index: IndexDef): string;
|
|
61
|
+
getRenameIndexSQL(tableName: string, index: IndexDef, oldIndexName: string): string[];
|
|
62
|
+
/** Returns SQL statements to apply a table difference (add/drop/alter columns, indexes, foreign keys). */
|
|
63
|
+
alterTable(diff: TableDifference, safe?: boolean): string[];
|
|
64
|
+
/** Returns SQL to add columns to an existing table. */
|
|
65
|
+
getAddColumnsSQL(table: DatabaseTable, columns: Column[]): string[];
|
|
66
|
+
getDropColumnsSQL(tableName: string, columns: Column[], schemaName?: string): string;
|
|
67
|
+
hasNonDefaultPrimaryKeyName(table: DatabaseTable): boolean;
|
|
68
|
+
castColumn(name: string, type: string): string;
|
|
69
|
+
alterTableColumn(column: Column, table: DatabaseTable, changedProperties: Set<string>): string[];
|
|
70
|
+
createTableColumn(column: Column, table: DatabaseTable, changedProperties?: Set<string>): string | undefined;
|
|
71
|
+
getPreAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
72
|
+
getPostAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
73
|
+
getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string;
|
|
74
|
+
getNamespaces(connection: AbstractSqlConnection): Promise<string[]>;
|
|
75
|
+
protected mapIndexes(indexes: IndexDef[]): Promise<IndexDef[]>;
|
|
76
|
+
mapForeignKeys(fks: any[], tableName: string, schemaName?: string): Dictionary;
|
|
77
|
+
normalizeDefaultValue(
|
|
78
|
+
defaultValue: string | RawQueryFragment,
|
|
79
|
+
length?: number,
|
|
80
|
+
defaultValues?: Dictionary<string[]>,
|
|
81
|
+
): string | number;
|
|
82
|
+
getCreateDatabaseSQL(name: string): string;
|
|
83
|
+
getDropDatabaseSQL(name: string): string;
|
|
84
|
+
getCreateNamespaceSQL(name: string): string;
|
|
85
|
+
getDropNamespaceSQL(name: string): string;
|
|
86
|
+
getDatabaseExistsSQL(name: string): string;
|
|
87
|
+
getDatabaseNotExistsError(dbName: string): string;
|
|
88
|
+
getManagementDbName(): string;
|
|
89
|
+
getDefaultEmptyString(): string;
|
|
90
|
+
databaseExists(connection: Connection, name: string): Promise<boolean>;
|
|
91
|
+
append(array: string[], sql: string | string[], pad?: boolean): void;
|
|
92
|
+
/** Returns SQL statements to create a table with all its columns, primary key, indexes, and checks. */
|
|
93
|
+
createTable(table: DatabaseTable, alter?: boolean): string[];
|
|
94
|
+
alterTableComment(table: DatabaseTable, comment?: string): string;
|
|
95
|
+
/** Returns SQL to create a foreign key constraint on a table. */
|
|
96
|
+
createForeignKey(table: DatabaseTable, foreignKey: ForeignKey, alterTable?: boolean, inline?: boolean): string;
|
|
97
|
+
splitTableName(name: string, skipDefaultSchema?: boolean): [string | undefined, string];
|
|
98
|
+
getReferencedTableName(referencedTableName: string, schema?: string): string;
|
|
99
|
+
createIndex(index: IndexDef, table: DatabaseTable, createPrimary?: boolean): string;
|
|
100
|
+
createCheck(table: DatabaseTable, check: CheckDef): string;
|
|
101
|
+
protected getTableName(table: string, schema?: string): string;
|
|
102
|
+
getTablesGroupedBySchemas(tables: Table[]): Map<string | undefined, Table[]>;
|
|
103
|
+
get options(): NonNullable<Options['schemaGenerator']>;
|
|
104
|
+
protected processComment(comment: string): string;
|
|
105
|
+
protected quote(...keys: (string | undefined)[]): string;
|
|
106
|
+
dropForeignKey(tableName: string, constraintName: string): string;
|
|
107
|
+
dropIndex(table: string, index: IndexDef, oldIndexName?: string): string;
|
|
108
|
+
dropConstraint(table: string, name: string): string;
|
|
109
|
+
/** Returns SQL to drop a table if it exists. */
|
|
110
|
+
dropTableIfExists(name: string, schema?: string): string;
|
|
111
|
+
createView(name: string, schema: string | undefined, definition: string): string;
|
|
112
|
+
dropViewIfExists(name: string, schema?: string): string;
|
|
113
|
+
createMaterializedView(name: string, schema: string | undefined, definition: string, withData?: boolean): string;
|
|
114
|
+
dropMaterializedViewIfExists(name: string, schema?: string): string;
|
|
115
|
+
refreshMaterializedView(name: string, schema?: string, concurrently?: boolean): string;
|
|
116
|
+
getListMaterializedViewsSQL(): string;
|
|
117
|
+
loadMaterializedViews(schema: DatabaseSchema, connection: AbstractSqlConnection, schemaName?: string): Promise<void>;
|
|
104
118
|
}
|