Browse Source

fix: remove default value from CreatedTime field since it's programmatically generated

pull/7304/head
Pranav C 11 months ago
parent
commit
1240f9e5f3
  1. 3
      packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts
  2. 4
      packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts
  3. 3
      packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts
  4. 3
      packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts
  5. 3
      packages/nocodb-sdk/src/lib/sqlUi/SqliteUi.ts
  6. 3
      packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts

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

@ -100,7 +100,7 @@ export class MssqlUi {
pk: false, pk: false,
un: false, un: false,
ai: false, ai: false,
cdf: 'GETDATE()', cdf: '',
clen: 45, clen: 45,
np: null, np: null,
ns: null, ns: null,
@ -736,7 +736,6 @@ export class MssqlUi {
break; break;
case 'CreatedTime': case 'CreatedTime':
colProp.dt = 'datetime'; colProp.dt = 'datetime';
colProp.cdf = 'GETDATE()';
break; break;
case 'LastModifiedTime': case 'LastModifiedTime':
colProp.dt = 'datetime'; colProp.dt = 'datetime';

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

@ -104,7 +104,7 @@ export class MysqlUi {
pk: false, pk: false,
un: false, un: false,
ai: false, ai: false,
cdf: 'CURRENT_TIMESTAMP', cdf: '',
clen: 45, clen: 45,
np: null, np: null,
ns: null, ns: null,
@ -1074,11 +1074,9 @@ export class MysqlUi {
break; break;
case 'CreatedTime': case 'CreatedTime':
colProp.dt = 'timestamp'; colProp.dt = 'timestamp';
colProp.cdf = 'CURRENT_TIMESTAMP';
break; break;
case 'LastModifiedTime': case 'LastModifiedTime':
colProp.dt = 'timestamp'; colProp.dt = 'timestamp';
colProp.cdf = 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP';
break; break;
case 'AutoNumber': case 'AutoNumber':
colProp.dt = 'int'; colProp.dt = 'int';

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

@ -163,7 +163,7 @@ export class PgUi {
pk: false, pk: false,
un: false, un: false,
ai: false, ai: false,
cdf: 'now()', cdf: '',
clen: 45, clen: 45,
np: null, np: null,
ns: null, ns: null,
@ -1687,7 +1687,6 @@ export class PgUi {
break; break;
case 'CreatedTime': case 'CreatedTime':
colProp.dt = 'timestamp'; colProp.dt = 'timestamp';
colProp.cdf = 'now()';
break; break;
case 'LastModifiedTime': case 'LastModifiedTime':
colProp.dt = 'timestamp'; colProp.dt = 'timestamp';

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

@ -99,7 +99,7 @@ export class SnowflakeUi {
pk: false, pk: false,
un: false, un: false,
ai: false, ai: false,
cdf: 'current_timestamp()', cdf: '',
clen: 45, clen: 45,
np: null, np: null,
ns: null, ns: null,
@ -778,7 +778,6 @@ export class SnowflakeUi {
break; break;
case 'CreatedTime': case 'CreatedTime':
colProp.dt = 'TIMESTAMP'; colProp.dt = 'TIMESTAMP';
colProp.cdf = 'current_timestamp()';
break; break;
case 'LastModifiedTime': case 'LastModifiedTime':
colProp.dt = 'TIMESTAMP'; colProp.dt = 'TIMESTAMP';

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

@ -87,7 +87,7 @@ export class SqliteUi {
pk: false, pk: false,
un: false, un: false,
ai: false, ai: false,
cdf: 'CURRENT_TIMESTAMP', cdf: '',
clen: 45, clen: 45,
np: null, np: null,
ns: null, ns: null,
@ -629,7 +629,6 @@ export class SqliteUi {
break; break;
case 'CreatedTime': case 'CreatedTime':
colProp.dt = 'datetime'; colProp.dt = 'datetime';
colProp.cdf = 'CURRENT_TIMESTAMP';
break; break;
case 'LastModifiedTime': case 'LastModifiedTime':
colProp.dt = 'datetime'; colProp.dt = 'datetime';

3
packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts

@ -113,6 +113,7 @@ async function upgradeModels({
}, },
source, source,
)), )),
cdf: null,
system: true, system: true,
altered: Altered.NEW_COLUMN, altered: Altered.NEW_COLUMN,
}); });
@ -125,10 +126,10 @@ async function upgradeModels({
uidt: UITypes.LastModifiedTime, uidt: UITypes.LastModifiedTime,
column_name: getUniqueColumnName(columns, 'updated_at'), column_name: getUniqueColumnName(columns, 'updated_at'),
title: getUniqueColumnAliasName(columns, 'Updated At'), title: getUniqueColumnAliasName(columns, 'Updated At'),
cdf: null,
}, },
source, source,
)), )),
cdf: null,
system: true, system: true,
altered: Altered.NEW_COLUMN, altered: Altered.NEW_COLUMN,
}); });

Loading…
Cancel
Save