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 'numeric':
case 'decimal':
return false;
case 'tinyint':
case 'float':
case 'bigint':
case 'int':
case 'tinyint':
return false;
case 'bigint':
case 'binary':
case 'bit':
case 'char':
@ -465,7 +464,7 @@ export class MssqlUi {
return '2';
case 'float':
return '2';
return '';
case 'geography':
return '';
@ -599,11 +598,7 @@ export class MssqlUi {
}
static showScale(columnObj) {
return (
columnObj.dt === 'float' ||
columnObj.dt === 'decimal' ||
columnObj.dt === 'numeric'
);
return columnObj.dt === 'decimal' || columnObj.dt === 'numeric';
}
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(
`\nALTER TABLE ?? ALTER COLUMN ?? ${n.dt}${scaleAndPrecision}`,
[this.getTnPath(t), n.cn],
@ -2773,19 +2778,19 @@ function getDefaultLengthIsDisabled(type) {
case 'text':
case 'time':
case 'timestamp':
case 'int':
case 'tinyint':
case 'bigint':
case 'bit':
case 'smallint':
case 'float':
case 'uniqueidentifier':
case 'xml':
return true;
break;
default:
case 'int':
case 'tinyint':
case 'bigint':
case 'bit':
case 'decimal':
case 'float':
case 'numeric':
case 'smallint':
case 'varchar':
return false;
break;

Loading…
Cancel
Save