Browse Source

fix: extract using alias reference if table_name reference is not found

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1858/head
Pranav C 3 years ago
parent
commit
8358666c9e
  1. 19
      packages/nocodb/src/lib/noco/upgrader/jobs/ncProjectUpgraderV2_0090000.ts

19
packages/nocodb/src/lib/noco/upgrader/jobs/ncProjectUpgraderV2_0090000.ts

@ -1078,8 +1078,12 @@ async function migrateUIAcl(ctx: MigrateCtxV1, ncMeta: any) {
// if missing parent model name skip the view acl migration
if (!acl.parent_model_title) continue;
fk_view_id =
ctx.objViewRef[acl.project_id]?.[acl.parent_model_title]?.[acl.title]
?.id;
ctx.objViewRef[acl.project_id]?.[
(
ctx.objModelRef?.[acl.project_id]?.[acl.parent_model_title] ||
ctx.objModelAliasRef?.[acl.project_id]?.[acl.parent_model_title]
)?.table_name
]?.[acl.title]?.id;
} else {
fk_view_id =
ctx.objViewRef?.[acl.project_id]?.[acl.title]?.[
@ -1121,9 +1125,14 @@ async function migrateSharedViews(ctx: MigrateCtxV1, ncMeta: any) {
if (sharedView.view_type !== 'table' && sharedView.view_type !== 'view') {
fk_view_id =
ctx.objViewRef[sharedView.project_id]?.[sharedView.model_name]?.[
sharedView.view_name
]?.id;
ctx.objViewRef[sharedView.project_id]?.[
(
ctx.objModelRef?.[sharedView.project_id]?.[sharedView.model_name] ||
ctx.objModelAliasRef?.[sharedView.project_id]?.[
sharedView.model_name
]
)?.title
]?.[sharedView.view_name]?.id;
} else {
fk_view_id =
ctx.objViewRef[sharedView.project_id]?.[sharedView.model_name]?.[

Loading…
Cancel
Save