Browse Source

fix(api): oracledb - identify identity column and mark it as autoincrement

feat/oracle-support
Pranav C 2 years ago committed by Pranav C
parent
commit
f001af1e04
  1. 3
      packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts
  2. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

3
packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts

@ -483,7 +483,8 @@ class OracleClient extends KnexClient {
seq.sequence_name,
CASE
WHEN seq.sequence_name IS NOT NULL
AND p.constraint_type = 'P' THEN 1
AND p.constraint_type = 'P' THEN 1
WHEN c.IDENTITY_COLUMN = 'YES' THEN 1
ELSE 0
END as ai,
c.table_name as tn,

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -1607,9 +1607,7 @@ class BaseModelSqlv2 {
if (this.isSqlite || this.isOracle) {
// sqlite doesnt return id after insert
id = (
await this.dbDriver(this.tnPath)
.select(ai.column_name)
.max(ai.column_name, { as: 'id' })
await this.dbDriver(this.tnPath).max(ai.column_name, { as: 'id' })
)[0].id;
} else if (this.isSnowflake) {
id = (

Loading…
Cancel
Save