Browse Source

fix(api): metasync/project create related issue

feat/oracle-support
Pranav C 2 years ago committed by Pranav C
parent
commit
00412ea0c0
  1. 3
      packages/nocodb/src/lib/db/sql-client/lib/oracle/OracleClient.ts
  2. 122
      packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts

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

@ -583,6 +583,9 @@ class OracleClient extends KnexClient {
el.au = false; el.au = false;
// remove any precision or scale value from datatype
el.dt = el.dt?.replace(/\([\d,]+\)$/, '');
response[i] = el; response[i] = el;
} }

122
packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts

@ -1,4 +1,5 @@
import BaseModelXcMeta from './BaseModelXcMeta'; import BaseModelXcMeta from './BaseModelXcMeta';
import { UITypes } from 'nocodb-sdk';
class ModelXcMetaOracle extends BaseModelXcMeta { class ModelXcMetaOracle extends BaseModelXcMeta {
/** /**
@ -270,75 +271,34 @@ class ModelXcMetaOracle extends BaseModelXcMeta {
getAbstractType(col): any { getAbstractType(col): any {
switch ((col.dt || col.dt).toLowerCase()) { switch ((col.dt || col.dt).toLowerCase()) {
case 'integer': case 'CHAR':
return 'integer'; case 'VARCHAR':
case 'bfile': case 'VARCHAR2':
case 'binary rowid': case 'NCHAR':
case 'binary double': case 'NVARCHAR2':
case 'binary_float':
return 'string';
case 'blob':
return 'blob';
case 'canoical':
case 'cfile':
case 'char':
case 'clob':
case 'content pointer':
case 'contigous array':
return 'string';
case 'date':
return 'date';
case 'decimal':
case 'double precision':
case 'float':
return 'float';
case 'interval day to second':
case 'interval year to month':
return 'string';
case 'lob pointer':
return 'string';
case 'long':
return 'integer';
case 'long raw':
return 'string';
case 'named collection':
case 'named object':
case 'nchar':
case 'nclob':
return 'string';
case 'nvarchar2':
case 'oid':
case 'pointer':
case 'raw':
return 'string'; return 'string';
case 'real': case 'NUMBER':
case 'number': case 'BINARY_FLOAT':
case 'BINARY_DOUBLE':
return 'float'; return 'float';
case 'ref': case 'CLOB':
case 'ref cursor': case 'NCLOB':
case 'rowid': return 'text';
case 'signed binary integer':
return 'string'; case 'DATE':
case 'smallint': case 'TIMESTAMP':
return 'integer'; case 'TIMESTAMP WITH LOCAL TIME ZONE':
case 'table': case 'TIMESTAMP WITH TIME ZONE':
return 'string';
case 'time':
case 'time with tz':
return 'time';
case 'timestamp':
case 'timestamp with local time zone':
case 'timestamp with local tz':
case 'timestamp with timezone':
case 'timestamp with tz':
return 'datetime'; return 'datetime';
case 'unsigned binary integer':
case 'urowid': case 'BLOB':
case 'varchar': case 'BFILE':
case 'varchar2': case 'RAW':
return 'string'; case 'LONG RAW':
case 'varray': case 'ROWID':
case 'varying array': case 'UROWID':
case 'XMLType':
case 'UriType':
return 'string'; return 'string';
} }
} }
@ -346,31 +306,27 @@ class ModelXcMetaOracle extends BaseModelXcMeta {
getUIDataType(col): any { getUIDataType(col): any {
switch (this.getAbstractType(col)) { switch (this.getAbstractType(col)) {
case 'integer': case 'integer':
return 'Number'; return UITypes.Number;
case 'boolean': case 'boolean':
return 'Checkbox'; return UITypes.Checkbox;
case 'float': case 'float':
return 'Decimal'; return UITypes.Number;
case 'date': case 'date':
return 'Date'; return UITypes.Date;
case 'datetime': case 'datetime':
return 'DateTime'; return UITypes.DateTime;
case 'time': case 'time':
return 'Time'; return UITypes.Time;
case 'year': case 'year':
return 'Year'; return UITypes.Year;
case 'string': case 'string':
return 'SingleLineText'; return UITypes.SingleLineText;
case 'text':
return 'LongText';
case 'blob': case 'blob':
return 'Attachment'; return UITypes.LongText;
case 'enum': case 'text':
return 'SingleSelect'; return UITypes.LongText;
case 'set': default:
return 'MultiSelect'; return UITypes.SpecificDBType;
case 'json':
return 'LongText';
} }
} }

Loading…
Cancel
Save