@mikro-orm/sql 7.2.3 → 7.2.4-dev.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.
@@ -128,8 +128,10 @@ export class SqliteSchemaHelper extends SchemaHelper {
128
128
  sql += `, primary key (${primaryKey.columnNames.map(c => this.quote(c)).join(', ')})`;
129
129
  }
130
130
  const parts = [];
131
- for (const fk of Object.values(table.getForeignKeys())) {
132
- parts.push(this.createForeignKey(table, fk, false));
131
+ if (this.options.createForeignKeyConstraints) {
132
+ for (const fk of Object.values(table.getForeignKeys())) {
133
+ parts.push(this.createForeignKey(table, fk, false));
134
+ }
133
135
  }
134
136
  for (const check of table.getChecks()) {
135
137
  const sql = `constraint ${this.quote(check.name)} check (${check.expression})`;
@@ -498,7 +500,7 @@ export class SqliteSchemaHelper extends SchemaHelper {
498
500
  const [schemaName, tableName] = this.splitTableName(diff.name);
499
501
  if (Utils.hasObjectKeys(diff.removedChecks) ||
500
502
  Utils.hasObjectKeys(diff.changedChecks) ||
501
- Utils.hasObjectKeys(diff.changedForeignKeys) ||
503
+ (this.options.createForeignKeyConstraints && Utils.hasObjectKeys(diff.changedForeignKeys)) ||
502
504
  Utils.hasObjectKeys(diff.changedColumns) ||
503
505
  // sqlite can only add or change a primary key by rebuilding the table
504
506
  [...Object.values(diff.addedIndexes), ...Object.values(diff.changedIndexes)].some(index => index.primary)) {
@@ -517,7 +519,8 @@ export class SqliteSchemaHelper extends SchemaHelper {
517
519
  if (Object.values(diff.addedColumns).length > 0) {
518
520
  this.append(ret, this.getAddColumnsSQL(diff.toTable, Object.values(diff.addedColumns), diff));
519
521
  }
520
- if (Utils.hasObjectKeys(diff.addedForeignKeys) || Utils.hasObjectKeys(diff.addedChecks)) {
522
+ if ((this.options.createForeignKeyConstraints && Utils.hasObjectKeys(diff.addedForeignKeys)) ||
523
+ Utils.hasObjectKeys(diff.addedChecks)) {
521
524
  return this.getAlterTempTableSQL(diff);
522
525
  }
523
526
  for (const [oldColumnName, column] of Object.entries(diff.renamedColumns)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.3",
3
+ "version": "7.2.4-dev.1",
4
4
  "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.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.2.3"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.3"
56
+ "@mikro-orm/core": "7.2.4-dev.1"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"