@mikro-orm/sql 7.0.14 → 7.0.15-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/AbstractSqlConnection.d.ts +58 -94
  2. package/AbstractSqlConnection.js +238 -235
  3. package/AbstractSqlDriver.d.ts +155 -410
  4. package/AbstractSqlDriver.js +1972 -2100
  5. package/AbstractSqlPlatform.d.ts +76 -86
  6. package/AbstractSqlPlatform.js +167 -169
  7. package/PivotCollectionPersister.d.ts +15 -33
  8. package/PivotCollectionPersister.js +160 -158
  9. package/README.md +1 -1
  10. package/SqlEntityManager.d.ts +22 -67
  11. package/SqlEntityManager.js +38 -54
  12. package/SqlEntityRepository.d.ts +14 -14
  13. package/SqlEntityRepository.js +23 -23
  14. package/SqlMikroORM.d.ts +8 -49
  15. package/SqlMikroORM.js +8 -8
  16. package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -12
  17. package/dialects/mssql/MsSqlNativeQueryBuilder.js +201 -199
  18. package/dialects/mysql/BaseMySqlPlatform.d.ts +46 -65
  19. package/dialects/mysql/BaseMySqlPlatform.js +134 -137
  20. package/dialects/mysql/MySqlExceptionConverter.d.ts +6 -6
  21. package/dialects/mysql/MySqlExceptionConverter.js +77 -91
  22. package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +3 -3
  23. package/dialects/mysql/MySqlNativeQueryBuilder.js +69 -66
  24. package/dialects/mysql/MySqlSchemaHelper.d.ts +39 -58
  25. package/dialects/mysql/MySqlSchemaHelper.js +319 -327
  26. package/dialects/oracledb/OracleDialect.d.ts +52 -81
  27. package/dialects/oracledb/OracleDialect.js +149 -155
  28. package/dialects/oracledb/OracleNativeQueryBuilder.d.ts +12 -12
  29. package/dialects/oracledb/OracleNativeQueryBuilder.js +243 -239
  30. package/dialects/postgresql/BasePostgreSqlPlatform.d.ts +107 -110
  31. package/dialects/postgresql/BasePostgreSqlPlatform.js +369 -370
  32. package/dialects/postgresql/FullTextType.d.ts +6 -10
  33. package/dialects/postgresql/FullTextType.js +51 -51
  34. package/dialects/postgresql/PostgreSqlExceptionConverter.d.ts +5 -5
  35. package/dialects/postgresql/PostgreSqlExceptionConverter.js +43 -55
  36. package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
  37. package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +4 -4
  38. package/dialects/postgresql/PostgreSqlSchemaHelper.d.ts +82 -117
  39. package/dialects/postgresql/PostgreSqlSchemaHelper.js +712 -748
  40. package/dialects/sqlite/BaseSqliteConnection.d.ts +5 -3
  41. package/dialects/sqlite/BaseSqliteConnection.js +19 -21
  42. package/dialects/sqlite/NodeSqliteDialect.d.ts +1 -1
  43. package/dialects/sqlite/NodeSqliteDialect.js +23 -23
  44. package/dialects/sqlite/SqliteDriver.d.ts +1 -1
  45. package/dialects/sqlite/SqliteDriver.js +3 -3
  46. package/dialects/sqlite/SqliteExceptionConverter.d.ts +6 -6
  47. package/dialects/sqlite/SqliteExceptionConverter.js +51 -67
  48. package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +2 -2
  49. package/dialects/sqlite/SqliteNativeQueryBuilder.js +7 -7
  50. package/dialects/sqlite/SqlitePlatform.d.ts +73 -64
  51. package/dialects/sqlite/SqlitePlatform.js +143 -143
  52. package/dialects/sqlite/SqliteSchemaHelper.d.ts +61 -78
  53. package/dialects/sqlite/SqliteSchemaHelper.js +522 -541
  54. package/package.json +2 -2
  55. package/plugin/index.d.ts +35 -42
  56. package/plugin/index.js +36 -43
  57. package/plugin/transformer.d.ts +94 -117
  58. package/plugin/transformer.js +881 -890
  59. package/query/ArrayCriteriaNode.d.ts +4 -4
  60. package/query/ArrayCriteriaNode.js +18 -18
  61. package/query/CriteriaNode.d.ts +25 -35
  62. package/query/CriteriaNode.js +132 -142
  63. package/query/CriteriaNodeFactory.d.ts +6 -49
  64. package/query/CriteriaNodeFactory.js +94 -97
  65. package/query/NativeQueryBuilder.d.ts +120 -120
  66. package/query/NativeQueryBuilder.js +501 -507
  67. package/query/ObjectCriteriaNode.d.ts +12 -12
  68. package/query/ObjectCriteriaNode.js +282 -298
  69. package/query/QueryBuilder.d.ts +906 -1558
  70. package/query/QueryBuilder.js +2202 -2331
  71. package/query/QueryBuilderHelper.d.ts +72 -153
  72. package/query/QueryBuilderHelper.js +1032 -1084
  73. package/query/ScalarCriteriaNode.d.ts +3 -3
  74. package/query/ScalarCriteriaNode.js +46 -53
  75. package/query/enums.d.ts +14 -14
  76. package/query/enums.js +14 -14
  77. package/query/raw.d.ts +6 -16
  78. package/query/raw.js +10 -10
  79. package/schema/DatabaseSchema.d.ts +50 -74
  80. package/schema/DatabaseSchema.js +331 -359
  81. package/schema/DatabaseTable.d.ts +73 -96
  82. package/schema/DatabaseTable.js +974 -1046
  83. package/schema/SchemaComparator.d.ts +66 -70
  84. package/schema/SchemaComparator.js +765 -790
  85. package/schema/SchemaHelper.d.ts +97 -128
  86. package/schema/SchemaHelper.js +668 -683
  87. package/schema/SqlSchemaGenerator.d.ts +59 -79
  88. package/schema/SqlSchemaGenerator.js +495 -525
  89. package/typings.d.ts +275 -405
@@ -1,15 +1,4 @@
1
- import {
2
- type ClearDatabaseOptions,
3
- type CreateSchemaOptions,
4
- type DropSchemaOptions,
5
- type EnsureDatabaseOptions,
6
- type EntityMetadata,
7
- type ISchemaGenerator,
8
- type MikroORM,
9
- type Options,
10
- type Transaction,
11
- type UpdateSchemaOptions,
12
- } from '@mikro-orm/core';
1
+ import { type ClearDatabaseOptions, type CreateSchemaOptions, type DropSchemaOptions, type EnsureDatabaseOptions, type EntityMetadata, type ISchemaGenerator, type MikroORM, type Options, type Transaction, type UpdateSchemaOptions } from '@mikro-orm/core';
13
2
  import { AbstractSchemaGenerator } from '@mikro-orm/core/schema';
14
3
  import type { SchemaDifference } from '../typings.js';
15
4
  import { DatabaseSchema } from './DatabaseSchema.js';
@@ -17,72 +6,63 @@ import type { AbstractSqlDriver } from '../AbstractSqlDriver.js';
17
6
  import type { SchemaHelper } from './SchemaHelper.js';
18
7
  /** Generates and manages SQL database schemas based on entity metadata. Supports create, update, and drop operations. */
19
8
  export declare class SqlSchemaGenerator extends AbstractSchemaGenerator<AbstractSqlDriver> implements ISchemaGenerator {
20
- protected readonly helper: SchemaHelper;
21
- protected readonly options: NonNullable<Options['schemaGenerator']>;
22
- protected lastEnsuredDatabase?: string;
23
- static register(orm: MikroORM): void;
24
- create(options?: CreateSchemaOptions): Promise<void>;
25
- /**
26
- * Returns true if the database was created.
27
- */
28
- ensureDatabase(options?: EnsureDatabaseOptions): Promise<boolean>;
29
- getTargetSchema(schema?: string): DatabaseSchema;
30
- protected getOrderedMetadata(schema?: string): EntityMetadata[];
31
- getCreateSchemaSQL(options?: CreateSchemaOptions): Promise<string>;
32
- drop(options?: DropSchemaOptions): Promise<void>;
33
- createNamespace(name: string): Promise<void>;
34
- dropNamespace(name: string): Promise<void>;
35
- clear(options?: ClearDatabaseOptions): Promise<void>;
36
- getDropSchemaSQL(options?: Omit<DropSchemaOptions, 'dropDb'>): Promise<string>;
37
- private getSchemaName;
38
- update(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<void>;
39
- getUpdateSchemaSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<string>;
40
- getUpdateSchemaMigrationSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<{
41
- up: string;
42
- down: string;
43
- }>;
44
- private prepareSchemaForComparison;
45
- diffToSQL(
46
- schemaDiff: SchemaDifference,
47
- options: {
48
- wrap?: boolean;
49
- safe?: boolean;
50
- dropTables?: boolean;
51
- schema?: string;
52
- },
53
- ): string;
54
- /**
55
- * We need to drop foreign keys first for all tables to allow dropping PK constraints.
56
- */
57
- private preAlterTable;
58
- /**
59
- * creates new database and connects to it
60
- */
61
- createDatabase(
62
- name?: string,
63
- options?: {
64
- skipOnConnect?: boolean;
65
- },
66
- ): Promise<void>;
67
- dropDatabase(name?: string): Promise<void>;
68
- execute(
69
- sql: string,
70
- options?: {
71
- wrap?: boolean;
72
- ctx?: Transaction;
73
- },
74
- ): Promise<void>;
75
- dropTableIfExists(name: string, schema?: string): Promise<void>;
76
- private wrapSchema;
77
- private append;
78
- private matchName;
79
- private isTableSkipped;
80
- /**
81
- * Sorts views by their dependencies so that views depending on other views are created after their dependencies.
82
- * Uses topological sort based on view definition string matching.
83
- */
84
- private sortViewsByDependencies;
85
- private appendViewCreation;
86
- private escapeRegExp;
9
+ protected readonly helper: SchemaHelper;
10
+ protected readonly options: NonNullable<Options['schemaGenerator']>;
11
+ protected lastEnsuredDatabase?: string;
12
+ static register(orm: MikroORM): void;
13
+ create(options?: CreateSchemaOptions): Promise<void>;
14
+ /**
15
+ * Returns true if the database was created.
16
+ */
17
+ ensureDatabase(options?: EnsureDatabaseOptions): Promise<boolean>;
18
+ getTargetSchema(schema?: string): DatabaseSchema;
19
+ protected getOrderedMetadata(schema?: string): EntityMetadata[];
20
+ getCreateSchemaSQL(options?: CreateSchemaOptions): Promise<string>;
21
+ drop(options?: DropSchemaOptions): Promise<void>;
22
+ createNamespace(name: string): Promise<void>;
23
+ dropNamespace(name: string): Promise<void>;
24
+ clear(options?: ClearDatabaseOptions): Promise<void>;
25
+ getDropSchemaSQL(options?: Omit<DropSchemaOptions, 'dropDb'>): Promise<string>;
26
+ private getSchemaName;
27
+ update(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<void>;
28
+ getUpdateSchemaSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<string>;
29
+ getUpdateSchemaMigrationSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<{
30
+ up: string;
31
+ down: string;
32
+ }>;
33
+ private prepareSchemaForComparison;
34
+ diffToSQL(schemaDiff: SchemaDifference, options: {
35
+ wrap?: boolean;
36
+ safe?: boolean;
37
+ dropTables?: boolean;
38
+ schema?: string;
39
+ }): string;
40
+ /**
41
+ * We need to drop foreign keys first for all tables to allow dropping PK constraints.
42
+ */
43
+ private preAlterTable;
44
+ /**
45
+ * creates new database and connects to it
46
+ */
47
+ createDatabase(name?: string, options?: {
48
+ skipOnConnect?: boolean;
49
+ }): Promise<void>;
50
+ dropDatabase(name?: string): Promise<void>;
51
+ execute(sql: string, options?: {
52
+ wrap?: boolean;
53
+ ctx?: Transaction;
54
+ }): Promise<void>;
55
+ dropTableIfExists(name: string, schema?: string): Promise<void>;
56
+ private wrapSchema;
57
+ private append;
58
+ private matchName;
59
+ private isTableSkipped;
60
+ /**
61
+ * Sorts views by their dependencies so that views depending on other views are created after their dependencies.
62
+ * Uses topological sort based on view definition string matching.
63
+ */
64
+ private sortViewsByDependencies;
65
+ private appendViewCreation;
66
+ private escapeRegExp;
87
67
  }
88
68
  export { SqlSchemaGenerator as SchemaGenerator };