|
|
@ -14,7 +14,7 @@ import { |
|
|
|
import Column from '../models/Column'; |
|
|
|
import Column from '../models/Column'; |
|
|
|
import LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn'; |
|
|
|
import LinkToAnotherRecordColumn from '../models/LinkToAnotherRecordColumn'; |
|
|
|
import NcHelp from '../utils/NcHelp'; |
|
|
|
import NcHelp from '../utils/NcHelp'; |
|
|
|
import RollupColumn from '../models/RollupColumn'; |
|
|
|
import RollupColumn, { ROLLUP_FUNCTIONS } from '../models/RollupColumn'; |
|
|
|
import View from '../models/View'; |
|
|
|
import View from '../models/View'; |
|
|
|
import GridView from '../models/GridView'; |
|
|
|
import GridView from '../models/GridView'; |
|
|
|
import KanbanView from '../models/KanbanView'; |
|
|
|
import KanbanView from '../models/KanbanView'; |
|
|
@ -92,14 +92,10 @@ async function migrateProjects( |
|
|
|
is_meta: !!projectConfig.prefix, |
|
|
|
is_meta: !!projectConfig.prefix, |
|
|
|
type: d.client, |
|
|
|
type: d.client, |
|
|
|
config: d, |
|
|
|
config: d, |
|
|
|
created_at: project.created_at, |
|
|
|
|
|
|
|
updated_at: project.updated_at, |
|
|
|
|
|
|
|
inflection_column: inflection.cn, |
|
|
|
inflection_column: inflection.cn, |
|
|
|
inflection_table: inflection.tn, |
|
|
|
inflection_table: inflection.tn, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}), |
|
|
|
}), |
|
|
|
created_at: project.created_at, |
|
|
|
|
|
|
|
updated_at: project.updated_at, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
const p = await Project.createProject(projectBody, ncMeta); |
|
|
|
const p = await Project.createProject(projectBody, ncMeta); |
|
|
|
projectsObj[p.id] = p; |
|
|
|
projectsObj[p.id] = p; |
|
|
@ -126,8 +122,6 @@ async function migrateProjectUsers( |
|
|
|
project_id: projectUser.project_id, |
|
|
|
project_id: projectUser.project_id, |
|
|
|
fk_user_id: projectUser.user_id, |
|
|
|
fk_user_id: projectUser.user_id, |
|
|
|
roles: projectUser.roles, |
|
|
|
roles: projectUser.roles, |
|
|
|
created_at: projectUser.created_at, |
|
|
|
|
|
|
|
updated_at: projectUser.updated_at, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta |
|
|
|
ncMeta |
|
|
|
); |
|
|
|
); |
|
|
@ -268,8 +262,6 @@ interface ModelMetav1 { |
|
|
|
m_to_m_meta: string; |
|
|
|
m_to_m_meta: string; |
|
|
|
order: number; |
|
|
|
order: number; |
|
|
|
view_order: number; |
|
|
|
view_order: number; |
|
|
|
created_at; |
|
|
|
|
|
|
|
updated_at; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type ObjModelColumnRefv1 = { |
|
|
|
type ObjModelColumnRefv1 = { |
|
|
@ -406,8 +398,6 @@ async function migrateProjectModels( |
|
|
|
title: modelData.alias, |
|
|
|
title: modelData.alias, |
|
|
|
// todo: sanitize
|
|
|
|
// todo: sanitize
|
|
|
|
type: modelData.type === 'table' ? ModelTypes.TABLE : ModelTypes.VIEW, |
|
|
|
type: modelData.type === 'table' ? ModelTypes.TABLE : ModelTypes.VIEW, |
|
|
|
created_at: modelData.created_at, |
|
|
|
|
|
|
|
updated_at: modelData.updated_at, |
|
|
|
|
|
|
|
mm: !!modelData.mm, |
|
|
|
mm: !!modelData.mm, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta |
|
|
|
ncMeta |
|
|
@ -613,7 +603,8 @@ async function migrateProjectModels( |
|
|
|
|
|
|
|
|
|
|
|
const colBody: Partial<RollupColumn & Column> = { |
|
|
|
const colBody: Partial<RollupColumn & Column> = { |
|
|
|
title: columnMeta._cn, |
|
|
|
title: columnMeta._cn, |
|
|
|
rollup_function: columnMeta.rl.fn, |
|
|
|
rollup_function: columnMeta.rl |
|
|
|
|
|
|
|
.fn as typeof ROLLUP_FUNCTIONS[number], |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
colBody.fk_rollup_column_id = |
|
|
|
colBody.fk_rollup_column_id = |
|
|
@ -883,14 +874,7 @@ async function migrateProjectModelViews( |
|
|
|
queryParams; |
|
|
|
queryParams; |
|
|
|
|
|
|
|
|
|
|
|
const insertObj: Partial< |
|
|
|
const insertObj: Partial< |
|
|
|
View & |
|
|
|
View & GridView & KanbanView & FormView & GalleryView |
|
|
|
GridView & |
|
|
|
|
|
|
|
KanbanView & |
|
|
|
|
|
|
|
FormView & |
|
|
|
|
|
|
|
GalleryView & { |
|
|
|
|
|
|
|
created_at; |
|
|
|
|
|
|
|
updated_at; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
> = { |
|
|
|
> = { |
|
|
|
title: viewData.title, |
|
|
|
title: viewData.title, |
|
|
|
show: true, |
|
|
|
show: true, |
|
|
@ -898,8 +882,6 @@ async function migrateProjectModelViews( |
|
|
|
fk_model_id: objModelRef[project.id][viewData.parent_model_title].id, |
|
|
|
fk_model_id: objModelRef[project.id][viewData.parent_model_title].id, |
|
|
|
project_id: project.id, |
|
|
|
project_id: project.id, |
|
|
|
base_id: baseId, |
|
|
|
base_id: baseId, |
|
|
|
created_at: viewData.created_at, |
|
|
|
|
|
|
|
updated_at: viewData.updated_at, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (viewData.show_as === 'grid') { |
|
|
|
if (viewData.show_as === 'grid') { |
|
|
@ -1082,8 +1064,6 @@ async function migrateUIAcl(ctx: MigrateCtxV1, ncMeta: any) { |
|
|
|
tn: string; |
|
|
|
tn: string; |
|
|
|
parent_model_title: string; |
|
|
|
parent_model_title: string; |
|
|
|
project_id: string; |
|
|
|
project_id: string; |
|
|
|
created_at?; |
|
|
|
|
|
|
|
updated_at?; |
|
|
|
|
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_disabled_models_for_role'); |
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_disabled_models_for_role'); |
|
|
|
|
|
|
|
|
|
|
|
for (const acl of uiAclList) { |
|
|
|
for (const acl of uiAclList) { |
|
|
@ -1116,8 +1096,6 @@ async function migrateUIAcl(ctx: MigrateCtxV1, ncMeta: any) { |
|
|
|
role: acl.role, |
|
|
|
role: acl.role, |
|
|
|
fk_view_id, |
|
|
|
fk_view_id, |
|
|
|
disabled: acl.disabled, |
|
|
|
disabled: acl.disabled, |
|
|
|
created_at: acl.created_at, |
|
|
|
|
|
|
|
updated_at: acl.updated_at, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta |
|
|
|
ncMeta |
|
|
|
); |
|
|
|
); |
|
|
@ -1216,8 +1194,6 @@ async function migratePlugins(ncMeta: any) { |
|
|
|
creator: plugin.creator, |
|
|
|
creator: plugin.creator, |
|
|
|
creator_website: plugin.creator_website, |
|
|
|
creator_website: plugin.creator_website, |
|
|
|
price: plugin.price, |
|
|
|
price: plugin.price, |
|
|
|
created_at: plugin.created_at, |
|
|
|
|
|
|
|
updated_at: plugin.updated_at, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1243,8 +1219,6 @@ async function migrateWebhooks(ctx: MigrateCtxV1, ncMeta: any) { |
|
|
|
retry_interval: number; |
|
|
|
retry_interval: number; |
|
|
|
timeout: number; |
|
|
|
timeout: number; |
|
|
|
active: boolean; |
|
|
|
active: boolean; |
|
|
|
created_at?; |
|
|
|
|
|
|
|
updated_at?; |
|
|
|
|
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_hooks'); |
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_hooks'); |
|
|
|
|
|
|
|
|
|
|
|
for (const hookMeta of hooks) { |
|
|
|
for (const hookMeta of hooks) { |
|
|
@ -1274,8 +1248,6 @@ async function migrateWebhooks(ctx: MigrateCtxV1, ncMeta: any) { |
|
|
|
retry_interval: hookMeta.retry_interval, |
|
|
|
retry_interval: hookMeta.retry_interval, |
|
|
|
timeout: hookMeta.timeout, |
|
|
|
timeout: hookMeta.timeout, |
|
|
|
active: hookMeta.active, |
|
|
|
active: hookMeta.active, |
|
|
|
created_at: hookMeta.created_at, |
|
|
|
|
|
|
|
updated_at: hookMeta.updated_at, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta |
|
|
|
ncMeta |
|
|
|
); |
|
|
|
); |
|
|
@ -1325,8 +1297,6 @@ async function migrateAutitLog( |
|
|
|
status: string; |
|
|
|
status: string; |
|
|
|
description: string; |
|
|
|
description: string; |
|
|
|
details: string; |
|
|
|
details: string; |
|
|
|
created_at: any; |
|
|
|
|
|
|
|
updated_at: any; |
|
|
|
|
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_audit'); |
|
|
|
}> = await ncMeta.metaList(null, null, 'nc_audit'); |
|
|
|
|
|
|
|
|
|
|
|
for (const audit of audits) { |
|
|
|
for (const audit of audits) { |
|
|
@ -1343,8 +1313,6 @@ async function migrateAutitLog( |
|
|
|
status: audit.status, |
|
|
|
status: audit.status, |
|
|
|
description: audit.description, |
|
|
|
description: audit.description, |
|
|
|
details: audit.details, |
|
|
|
details: audit.details, |
|
|
|
created_at: audit.created_at, |
|
|
|
|
|
|
|
updated_at: audit.updated_at, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (audit.model_name) { |
|
|
|
if (audit.model_name) { |
|
|
|