Browse Source

fix: avoid removing/resetting default value and pg trigger

pull/7304/head
Pranav C 11 months ago
parent
commit
5d0a090325
  1. 11
      packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts

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

@ -17,6 +17,7 @@ import { Altered } from '~/services/columns.service';
const logger = new Logger('ncXcdbCreatedAndUpdatedTimeUpgrader'); const logger = new Logger('ncXcdbCreatedAndUpdatedTimeUpgrader');
/* Enable if planning to remove trigger
async function deletePgTrigger({ async function deletePgTrigger({
column, column,
ncMeta, ncMeta,
@ -36,6 +37,7 @@ async function deletePgTrigger({
]); ]);
await ncMeta.knex.raw(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]); await ncMeta.knex.raw(`DROP FUNCTION IF EXISTS ??()`, [triggerFnName]);
} }
*/
async function upgradeModels({ async function upgradeModels({
ncMeta, ncMeta,
@ -71,19 +73,14 @@ async function upgradeModels({
ncMeta, ncMeta,
); );
/* Enable if planning to remove trigger
if (source.type === 'pg') { if (source.type === 'pg') {
// delete pg trigger if exists // delete pg trigger if exists
await deletePgTrigger({ column, ncMeta, model }); await deletePgTrigger({ column, ncMeta, model });
} }*/
} }
if (column.uidt === 'updated_at') { if (column.uidt === 'updated_at') {
isLastModifiedTimeExists = true; isLastModifiedTimeExists = true;
Object.assign(column, {
uidt: UITypes.LastModifiedTime,
system: true,
cdf: '',
au: false,
});
await Column.update( await Column.update(
column.id, column.id,
{ {

Loading…
Cancel
Save