Browse Source

feat: add default value for created/modified time uidt

pull/7304/head
Pranav C 11 months ago
parent
commit
626f96f3ca
  1. 2
      packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts
  2. 6
      packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts
  3. 5
      packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts
  4. 2
      packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts
  5. 2
      packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts
  6. 2
      packages/nocodb/src/services/columns.service.ts

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

@ -735,9 +735,11 @@ export class MssqlUi {
break;
case 'CreateTime':
colProp.dt = 'datetime';
colProp.cdf = 'GETDATE()';
break;
case 'LastModifiedTime':
colProp.dt = 'datetime';
colProp.cdf = 'GETDATE()';
break;
case 'AutoNumber':
colProp.dt = 'int';

6
packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts

@ -1072,10 +1072,12 @@ export class MysqlUi {
colProp.dt = 'datetime';
break;
case 'CreateTime':
colProp.dt = 'datetime';
colProp.dt = 'timestamp';
colProp.cdf = 'CURRENT_TIMESTAMP'
break;
case 'LastModifiedTime':
colProp.dt = 'datetime';
colProp.dt = 'timestamp';
colProp.cdf = 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'
break;
case 'AutoNumber':
colProp.dt = 'int';

5
packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts

@ -1159,7 +1159,7 @@ export class PgUi {
static columnEditable(colObj) {
return colObj.tn !== '_evolutions' || colObj.tn !== 'nc_evolutions';
}
/*
/*
static extractFunctionName(query) {
const reg =
@ -1687,9 +1687,10 @@ export class PgUi {
break;
case 'CreateTime':
colProp.dt = 'timestamp';
colProp.cdf = 'now()';
break;
case 'LastModifiedTime':
colProp.dt = 'timestamp';
colProp.cdf = 'now()';
break;
case 'AutoNumber':
colProp.dt = 'int';

2
packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts

@ -778,9 +778,11 @@ export class SnowflakeUi {
break;
case 'CreateTime':
colProp.dt = 'TIMESTAMP';
colProp.cdf = 'current_timestamp()';
break;
case 'LastModifiedTime':
colProp.dt = 'TIMESTAMP';
colProp.cdf = 'current_timestamp()';
break;
case 'AutoNumber':
colProp.dt = 'INT';

2
packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts

@ -628,9 +628,11 @@ export class SqliteUi {
break;
case 'CreateTime':
colProp.dt = 'datetime';
colProp.cdf = 'CURRENT_TIMESTAMP';
break;
case 'LastModifiedTime':
colProp.dt = 'datetime';
colProp.cdf = 'CURRENT_TIMESTAMP';
break;
case 'AutoNumber':
colProp.dt = 'integer';

2
packages/nocodb/src/services/columns.service.ts

@ -1749,6 +1749,8 @@ export class ColumnsService {
if (!dbColumn) {
// create column in db
const column = sqlClient
}
await Column.insert({

Loading…
Cancel
Save