Browse Source

fix(api): oracledb - hm/bt column creation

feat/oracle-support
Pranav C 2 years ago committed by Pranav C
parent
commit
c803bd215c
  1. 8
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue
  2. 2
      packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts
  3. 6
      packages/nocodb/src/lib/meta/api/columnApis.ts

8
packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ModelTypes, MssqlUi, SqliteUi } from 'nocodb-sdk'
import {ModelTypes, MssqlUi, OracleUi, SqliteUi} from 'nocodb-sdk'
import { MetaInj, inject, ref, useProject, useVModel } from '#imports'
import MdiPlusIcon from '~icons/mdi/plus-circle-outline'
import MdiMinusIcon from '~icons/mdi/minus-circle-outline'
@ -22,7 +22,11 @@ setAdditionalValidations({
childId: [{ required: true, message: 'Required' }],
})
const onUpdateDeleteOptions = sqlUi === MssqlUi ? ['NO ACTION'] : ['NO ACTION', 'CASCADE', 'RESTRICT', 'SET NULL', 'SET DEFAULT']
let onUpdateDeleteOptions:(string|null)[] = sqlUi === MssqlUi ? ['NO ACTION'] : ['NO ACTION', 'CASCADE', 'RESTRICT', 'SET NULL', 'SET DEFAULT']
if(sqlUi === OracleUi){
onUpdateDeleteOptions = [null ,'CASCADE']
}
if (!vModel.value.parentId) vModel.value.parentId = meta?.id
if (!vModel.value.childId) vModel.value.childId = null

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

@ -2051,7 +2051,7 @@ class OracleClient extends KnexClient {
query += defaultValue ? ` DEFAULT ${defaultValue}` : '';
}
} else if (change === 1) {
query += ` ADD ${n.cn} ${n.dt}`;
query += this.genQuery(` ADD ?? ${n.dt}`, [n.cn]);
if (!['CLOB', 'NCLOB'].includes(n.dt)) {
query += n.dtxp && n.dtxp !== ' ' ? `(${n.dtxp}` : '';

6
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -205,8 +205,10 @@ export async function columnAdd(
childColumn: fkColName,
childTable: child.table_name,
parentTable: parent.table_name,
onDelete: 'NO ACTION',
onUpdate: 'NO ACTION',
onDelete:
'onDelete' in colBody ? colBody.onDelete : 'NO ACTION',
onUpdate:
'onUpdate' in colBody ? colBody.onUpdate : 'NO ACTION',
type: 'real',
parentColumn: parent.primaryKey.column_name,
foreignKeyName,

Loading…
Cancel
Save