This commit is contained in:
2026-06-26 10:10:40 +08:00
parent db3bddca8c
commit 857c70f493
+13 -1
View File
@@ -413,6 +413,12 @@ async def _seed_data():
existing_page = existing.scalar_one_or_none()
parent_id = frontend_group_ids.get(group_label)
if parent_id:
parent_exists = await db.execute(
select(MenuConfig).where(MenuConfig.id == parent_id).limit(1)
)
if not parent_exists.scalar_one_or_none():
parent_id = None
if not parent_id:
group_exists = await db.execute(
select(MenuConfig).where(
@@ -439,7 +445,7 @@ async def _seed_data():
if existing_page.is_default != is_default:
existing_page.is_default = is_default
needs_update = True
if parent_id and existing_page.parent_id != parent_id:
if existing_page.parent_id != parent_id:
existing_page.parent_id = parent_id
needs_update = True
else:
@@ -521,6 +527,12 @@ async def _seed_data():
existing_page = existing.scalar_one_or_none()
parent_id = admin_group_ids.get(parent_group) if parent_group else None
if parent_id:
parent_exists = await db.execute(
select(MenuConfig).where(MenuConfig.id == parent_id).limit(1)
)
if not parent_exists.scalar_one_or_none():
parent_id = None
if not parent_id and parent_group:
group_exists = await db.execute(
select(MenuConfig).where(