@mikro-orm/oracledb 7.3.0-dev.7 → 7.3.0-dev.9

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.
@@ -234,17 +234,12 @@ export class OracleSchemaHelper extends SchemaHelper {
234
234
  const isPrimary = index.constraint_type === 'P';
235
235
  const isUniqueConstraint = index.constraint_type === 'U';
236
236
  const isConstraintIndex = isPrimary || isUniqueConstraint;
237
- // Skip indexes that back PRIMARY KEY constraints - they're handled as part of the table definition
238
- // and should not be managed as separate indexes
239
- if (isPrimary) {
240
- continue;
241
- }
242
237
  const partialMatch = typeof index.expression === 'string' ? OracleSchemaHelper.PARTIAL_INDEX_RE.exec(index.expression) : null;
243
238
  const indexDef = {
244
239
  columnNames: [partialMatch ? partialMatch[2] : index.column_name],
245
240
  keyName: index.index_name,
246
241
  unique: index.is_unique === 'YES',
247
- primary: false,
242
+ primary: isPrimary,
248
243
  constraint: isConstraintIndex || index.is_unique === 'YES',
249
244
  };
250
245
  /* v8 ignore start: function-based (non-partial) index branches */
@@ -412,7 +407,8 @@ export class OracleSchemaHelper extends SchemaHelper {
412
407
  const changedTypes = Object.values(tableDiff.changedColumns).filter(col => col.changedProperties.has('type'));
413
408
  for (const col of changedTypes) {
414
409
  for (const index of indexes) {
415
- if (index.columnNames.includes(col.column.name)) {
410
+ // the index backing the primary key can't be dropped, the key constraint stays in place
411
+ if (!index.primary && index.columnNames.includes(col.column.name)) {
416
412
  ret.push(this.getDropIndexSQL(name, index));
417
413
  }
418
414
  }
@@ -430,7 +426,7 @@ export class OracleSchemaHelper extends SchemaHelper {
430
426
  const changedTypes = Object.values(tableDiff.changedColumns).filter(col => col.changedProperties.has('type'));
431
427
  for (const col of changedTypes) {
432
428
  for (const index of indexes) {
433
- if (index.columnNames.includes(col.column.name)) {
429
+ if (!index.primary && index.columnNames.includes(col.column.name)) {
434
430
  this.append(ret, this.getCreateIndexSQL(name, index));
435
431
  }
436
432
  }
@@ -457,8 +453,9 @@ export class OracleSchemaHelper extends SchemaHelper {
457
453
  return `drop index ${this.quote(index.keyName)}`;
458
454
  }
459
455
  dropIndex(table, index, oldIndexName = index.keyName) {
456
+ // the primary key constraint name is system generated unless named explicitly
460
457
  if (index.primary) {
461
- return `alter table ${this.quote(table)} drop constraint ${this.quote(oldIndexName)}`;
458
+ return `alter table ${this.quote(table)} drop primary key`;
462
459
  }
463
460
  return `drop index ${this.quote(oldIndexName)}`;
464
461
  }
@@ -568,7 +565,7 @@ export class OracleSchemaHelper extends SchemaHelper {
568
565
  }
569
566
  createIndex(index, table, createPrimary = false) {
570
567
  if (index.primary) {
571
- return '';
568
+ return createPrimary ? super.createIndex(index, table, true) : '';
572
569
  }
573
570
  if (index.expression) {
574
571
  return index.expression;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/oracledb",
3
- "version": "7.3.0-dev.7",
3
+ "version": "7.3.0-dev.9",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite, MSSQL and Oracle databases.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -42,7 +42,7 @@
42
42
  "copy": "node ../../scripts/copy.mjs"
43
43
  },
44
44
  "dependencies": {
45
- "@mikro-orm/sql": "7.3.0-dev.7",
45
+ "@mikro-orm/sql": "7.3.0-dev.9",
46
46
  "kysely": "0.29.6",
47
47
  "oracledb": "7.0.1"
48
48
  },
@@ -50,7 +50,7 @@
50
50
  "@mikro-orm/core": "^7.2.2"
51
51
  },
52
52
  "peerDependencies": {
53
- "@mikro-orm/core": "7.3.0-dev.7"
53
+ "@mikro-orm/core": "7.3.0-dev.9"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">= 22.17.0"