@mikro-orm/oracledb 7.3.0-dev.10 → 7.3.0-dev.11
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/OracleSchemaGenerator.js
CHANGED
|
@@ -369,8 +369,10 @@ export class OracleSchemaGenerator extends SchemaGenerator {
|
|
|
369
369
|
.join('.');
|
|
370
370
|
// Use DELETE instead of TRUNCATE to avoid ORA-02266 (FK constraint check regardless of data)
|
|
371
371
|
stmts.push(`begin execute immediate 'delete from ${quoted}'; exception when others then if sqlcode != -942 then raise; end if; end;`);
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
// non-PK identity columns are only reset when they declare `sequence`
|
|
373
|
+
for (const prop of meta.props.filter(p => p.autoincrement && (p.primary || p.sequence))) {
|
|
374
|
+
const startWith = prop.sequence?.startWith ?? 'limit value';
|
|
375
|
+
stmts.push(`begin execute immediate 'alter table ${quoted} modify ${this.platform.quoteIdentifier(prop.fieldNames[0])} generated by default as identity (start with ${startWith})'; exception when others then null; end;`);
|
|
374
376
|
}
|
|
375
377
|
}
|
|
376
378
|
/* v8 ignore next 5: empty stmts branch */
|
package/OracleSchemaHelper.js
CHANGED
|
@@ -145,9 +145,12 @@ export class OracleSchemaHelper extends SchemaHelper {
|
|
|
145
145
|
atc.data_length as data_length,
|
|
146
146
|
atc.identity_column as is_identity,
|
|
147
147
|
atc.column_id as ordinal_position,
|
|
148
|
-
atc.collation as collation_name
|
|
148
|
+
atc.collation as collation_name,
|
|
149
|
+
regexp_substr(aic.identity_options, 'START WITH: (-?\\d+)', 1, 1, null, 1) as sequence_start,
|
|
150
|
+
regexp_substr(aic.identity_options, 'INCREMENT BY: (-?\\d+)', 1, 1, null, 1) as sequence_increment
|
|
149
151
|
from all_tab_cols atc
|
|
150
152
|
left join all_col_comments acc on atc.owner = acc.owner and atc.table_name = acc.table_name and atc.column_name = acc.column_name
|
|
153
|
+
left join all_tab_identity_cols aic on atc.owner = aic.owner and atc.table_name = aic.table_name and atc.column_name = aic.column_name
|
|
151
154
|
where atc.hidden_column = 'NO'
|
|
152
155
|
and (${[...tablesBySchemas.entries()].map(([schema, tables]) => `(atc.table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')}) and atc.owner = ${this.platform.quoteValue(schema)})`).join(' or ')})
|
|
153
156
|
order by atc.owner, atc.table_name, atc.column_id`;
|
|
@@ -198,6 +201,7 @@ export class OracleSchemaHelper extends SchemaHelper {
|
|
|
198
201
|
default: increments ? undefined : this.wrap(defaultValue, mappedType),
|
|
199
202
|
nullable: col.is_nullable === 'Y',
|
|
200
203
|
autoincrement: increments,
|
|
204
|
+
sequence: increments ? this.getIntrospectedSequence(col.sequence_start, col.sequence_increment) : undefined,
|
|
201
205
|
precision: col.numeric_precision,
|
|
202
206
|
scale: col.numeric_scale,
|
|
203
207
|
comment: col.column_comment,
|
|
@@ -493,7 +497,8 @@ export class OracleSchemaHelper extends SchemaHelper {
|
|
|
493
497
|
const columnType = column.generated ? `as ${column.generated}` : column.type;
|
|
494
498
|
const col = [this.quote(column.name), columnType];
|
|
495
499
|
Utils.runIfNotEmpty(() => col.push(this.getCollateSQL(column.collation)), column.collation);
|
|
496
|
-
|
|
500
|
+
const sequenceOptions = this.getSequenceOptionsSQL(column);
|
|
501
|
+
Utils.runIfNotEmpty(() => col.push(`generated by default as identity${sequenceOptions ? ` (${sequenceOptions})` : ''}`), column.autoincrement);
|
|
497
502
|
/* v8 ignore next 3: default value branch */
|
|
498
503
|
const useDefault = changedProperties
|
|
499
504
|
? false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/oracledb",
|
|
3
|
-
"version": "7.3.0-dev.
|
|
3
|
+
"version": "7.3.0-dev.11",
|
|
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.
|
|
45
|
+
"@mikro-orm/sql": "7.3.0-dev.11",
|
|
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.
|
|
53
|
+
"@mikro-orm/core": "7.3.0-dev.11"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">= 22.17.0"
|