@mikro-orm/sql
Advanced tools
@@ -1,2 +0,2 @@ | ||
| import { type SimpleColumnMeta, type Type, type TransformContext, type IsolationLevel } from '@mikro-orm/core'; | ||
| import { type SimpleColumnMeta, type Type, type TransformContext, type MikroORM, type IsolationLevel } from '@mikro-orm/core'; | ||
| import { MySqlSchemaHelper } from './MySqlSchemaHelper.js'; | ||
@@ -19,2 +19,3 @@ import { MySqlExceptionConverter } from './MySqlExceptionConverter.js'; | ||
| getDefaultCharset(): string; | ||
| init(orm: MikroORM): void; | ||
| getBeginTransactionSQL(options?: { | ||
@@ -21,0 +22,0 @@ isolationLevel?: IsolationLevel; |
@@ -22,2 +22,6 @@ import { Utils, QueryOrder, DecimalType, DoubleType, } from '@mikro-orm/core'; | ||
| } | ||
| init(orm) { | ||
| super.init(orm); | ||
| orm.config.get('schemaGenerator').disableForeignKeysForClear ??= true; | ||
| } | ||
| getBeginTransactionSQL(options) { | ||
@@ -24,0 +28,0 @@ if (options?.isolationLevel || options?.readOnly) { |
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.0.0-dev.222", | ||
| "version": "7.0.0-dev.223", | ||
| "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.", | ||
@@ -59,4 +59,4 @@ "type": "module", | ||
| "peerDependencies": { | ||
| "@mikro-orm/core": "7.0.0-dev.222" | ||
| "@mikro-orm/core": "7.0.0-dev.223" | ||
| } | ||
| } |
@@ -67,2 +67,3 @@ import { type Connection, type Dictionary, RawQueryFragment } from '@mikro-orm/core'; | ||
| disableForeignKeys?: boolean; | ||
| disableForeignKeysForClear?: boolean; | ||
| createForeignKeyConstraints?: boolean; | ||
@@ -69,0 +70,0 @@ ignoreSchema?: string[]; |
@@ -9,2 +9,3 @@ import { AbstractSchemaGenerator, type ClearDatabaseOptions, type CreateSchemaOptions, type Dictionary, type DropSchemaOptions, type EnsureDatabaseOptions, type EntityMetadata, type ISchemaGenerator, type MikroORM, type Transaction, type UpdateSchemaOptions } from '@mikro-orm/core'; | ||
| disableForeignKeys?: boolean; | ||
| disableForeignKeysForClear?: boolean; | ||
| createForeignKeyConstraints?: boolean; | ||
@@ -11,0 +12,0 @@ ignoreSchema?: string[]; |
@@ -125,3 +125,5 @@ import { AbstractSchemaGenerator, CommitOrderCalculator, Utils, } from '@mikro-orm/core'; | ||
| } | ||
| await this.execute(this.helper.disableForeignKeysSQL()); | ||
| if (this.options.disableForeignKeysForClear) { | ||
| await this.execute(this.helper.disableForeignKeysSQL()); | ||
| } | ||
| const schema = options?.schema ?? this.config.get('schema', this.platform.getDefaultSchemaName()); | ||
@@ -134,3 +136,5 @@ for (const meta of this.getOrderedMetadata(schema).reverse()) { | ||
| } | ||
| await this.execute(this.helper.enableForeignKeysSQL()); | ||
| if (this.options.disableForeignKeysForClear) { | ||
| await this.execute(this.helper.enableForeignKeysSQL()); | ||
| } | ||
| if (options?.clearIdentityMap ?? true) { | ||
@@ -137,0 +141,0 @@ this.clearIdentityMap(); |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
833716
0.05%14709
0.07%