Browse Source

fix(api): hide length and scale for int and float types

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4883/head
Pranav C 2 years ago
parent
commit
918d089061
  1. 15
      packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts
  2. 19
      packages/nocodb/src/lib/db/sql-client/lib/mssql/MssqlClient.ts

15
packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts

@ -280,12 +280,11 @@ export class MssqlUi {
case 'nvarchar': case 'nvarchar':
case 'numeric': case 'numeric':
case 'decimal': case 'decimal':
return false;
case 'tinyint':
case 'float': case 'float':
case 'bigint':
case 'int': case 'int':
case 'tinyint': case 'bigint':
return false;
case 'binary': case 'binary':
case 'bit': case 'bit':
case 'char': case 'char':
@ -465,7 +464,7 @@ export class MssqlUi {
return '2'; return '2';
case 'float': case 'float':
return '2'; return '';
case 'geography': case 'geography':
return ''; return '';
@ -599,11 +598,7 @@ export class MssqlUi {
} }
static showScale(columnObj) { static showScale(columnObj) {
return ( return columnObj.dt === 'decimal' || columnObj.dt === 'numeric';
columnObj.dt === 'float' ||
columnObj.dt === 'decimal' ||
columnObj.dt === 'numeric'
);
} }
static removeUnsigned(columns) { static removeUnsigned(columns) {

19
packages/nocodb/src/lib/db/sql-client/lib/mssql/MssqlClient.ts

@ -2633,7 +2633,12 @@ class MssqlClient extends KnexClient {
); );
} }
if (n.dtxp !== o.dtxp ||n.dtxs !== o.dtxs || n.dt !== o.dt || n.rqd !== o.rqd) { if (
n.dtxp !== o.dtxp ||
n.dtxs !== o.dtxs ||
n.dt !== o.dt ||
n.rqd !== o.rqd
) {
query += this.genQuery( query += this.genQuery(
`\nALTER TABLE ?? ALTER COLUMN ?? ${n.dt}${scaleAndPrecision}`, `\nALTER TABLE ?? ALTER COLUMN ?? ${n.dt}${scaleAndPrecision}`,
[this.getTnPath(t), n.cn], [this.getTnPath(t), n.cn],
@ -2773,19 +2778,19 @@ function getDefaultLengthIsDisabled(type) {
case 'text': case 'text':
case 'time': case 'time':
case 'timestamp': case 'timestamp':
case 'int':
case 'tinyint':
case 'bigint':
case 'bit':
case 'smallint':
case 'float':
case 'uniqueidentifier': case 'uniqueidentifier':
case 'xml': case 'xml':
return true; return true;
break; break;
default: default:
case 'int':
case 'tinyint':
case 'bigint':
case 'bit':
case 'decimal': case 'decimal':
case 'float':
case 'numeric': case 'numeric':
case 'smallint':
case 'varchar': case 'varchar':
return false; return false;
break; break;

Loading…
Cancel
Save