|
|
@ -8,7 +8,7 @@ import { Column, Model } from '~/models'; |
|
|
|
// An upgrader for upgrading created_at and updated_at columns
|
|
|
|
// An upgrader for upgrading created_at and updated_at columns
|
|
|
|
// to system column and convert to new uidt CreatedTime and LastModifiedTime
|
|
|
|
// to system column and convert to new uidt CreatedTime and LastModifiedTime
|
|
|
|
|
|
|
|
|
|
|
|
const logger = new Logger('XcdbCreatedAndUpdatedTimeUpgrader'); |
|
|
|
const logger = new Logger('ncXcdbCreatedAndUpdatedTimeUpgrader'); |
|
|
|
|
|
|
|
|
|
|
|
async function upgradeModels({ |
|
|
|
async function upgradeModels({ |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
@ -29,6 +29,7 @@ async function upgradeModels({ |
|
|
|
models.map(async (model: any) => { |
|
|
|
models.map(async (model: any) => { |
|
|
|
const columns = await model.getColumns(ncMeta); |
|
|
|
const columns = await model.getColumns(ncMeta); |
|
|
|
for (const column of columns) { |
|
|
|
for (const column of columns) { |
|
|
|
|
|
|
|
if(column.uidt !== UITypes.DateTime) continue; |
|
|
|
if (column.column_name === 'created_at') { |
|
|
|
if (column.column_name === 'created_at') { |
|
|
|
await Column.update(column.id, { |
|
|
|
await Column.update(column.id, { |
|
|
|
uidt: UITypes.CreatedTime, |
|
|
|
uidt: UITypes.CreatedTime, |
|
|
|