|
|
@ -4,7 +4,7 @@ import Base from '../models/Base'; |
|
|
|
import Model from '../models/Model'; |
|
|
|
import Model from '../models/Model'; |
|
|
|
import { XKnex } from '../db/sql-data-mapper/index'; |
|
|
|
import { XKnex } from '../db/sql-data-mapper/index'; |
|
|
|
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; |
|
|
|
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; |
|
|
|
import { UITypes } from 'nocodb-sdk'; |
|
|
|
import { BaseType, UITypes } from 'nocodb-sdk' |
|
|
|
|
|
|
|
|
|
|
|
// before 0.103.0, an attachment object was like
|
|
|
|
// before 0.103.0, an attachment object was like
|
|
|
|
// [{
|
|
|
|
// [{
|
|
|
@ -42,12 +42,13 @@ function getTnPath(knex: XKnex, tb: Model) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default async function ({ ncMeta }: NcUpgraderCtx) { |
|
|
|
export default async function ({ ncMeta }: NcUpgraderCtx) { |
|
|
|
const bases: Base[] = await ncMeta.metaList2(null, null, MetaTable.BASES); |
|
|
|
const bases: BaseType[] = await ncMeta.metaList2(null, null, MetaTable.BASES); |
|
|
|
for (const base of bases) { |
|
|
|
for (const _base of bases) { |
|
|
|
|
|
|
|
const base = new Base(_base); |
|
|
|
const knex: XKnex = base.is_meta |
|
|
|
const knex: XKnex = base.is_meta |
|
|
|
? ncMeta.knexConnection |
|
|
|
? ncMeta.knexConnection |
|
|
|
: NcConnectionMgrv2.get(base); |
|
|
|
: NcConnectionMgrv2.get(base); |
|
|
|
const models = await (await Base.get(base.id, ncMeta)).getModels(ncMeta); |
|
|
|
const models = await base.getModels(ncMeta); |
|
|
|
for (const model of models) { |
|
|
|
for (const model of models) { |
|
|
|
const updateRecords = []; |
|
|
|
const updateRecords = []; |
|
|
|
const columns = await ( |
|
|
|
const columns = await ( |
|
|
|