|
|
@ -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, |
|
|
|
{ |
|
|
|
{ |
|
|
|