Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update data migration (#18401)

ecmadao438e123de52f
diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vue
index e41469d7a8..fa2166799e 100644
--- a/frontend/src/components/ProvideSQLEditorContext.vue
+++ b/frontend/src/components/ProvideSQLEditorContext.vue
@@ -132,6 +132,7 @@ const initializeProject = async () => {
// clear last visit project.
editorStore.setProject("");
}
+ return editorStore.project;
};
const switchWorksheet = async (sheetName: string) => {
@@ -377,7 +378,7 @@ const restoreLastVisitedSidebarTab = () => {
onMounted(async () => {
editorStore.projectContextReady = false;
- await Promise.all([
+ const [_, project] = await Promise.all([
policyStore.fetchPolicies({
resourceType: PolicyResourceType.WORKSPACE,
}),
@@ -385,6 +386,7 @@ onMounted(async () => {
]);
await migrateLegacyCache();
+ await tabStore.initProject(project);
await initializeConnectionFromQuery();
syncURLWithConnection();
});
diff --git a/frontend/src/store/modules/sqlEditor/tab.ts b/frontend/src/store/modules/sqlEditor/tab.ts
index 767ace8c37..5edab349e4 100644
--- a/frontend/src/store/modules/sqlEditor/tab.ts
+++ b/frontend/src/store/modules/sqlEditor/tab.ts
@@ -115,7 +115,9 @@ export const useSQLEditorTabStore = defineStore("sqlEditorTab", () => {
openTmpTabList.value = [...validOpenTabMap.values()];
};
- const maybeInitProject = async () => {
+ const initProject = async (project: string) => {
+ await migrateDraftsFromCache(project);
+ migrateTabViewState(project);
tabsById.clear();
await loadStoredTabs();
currentTabId.value = head(openTmpTabList.value)?.id ?? "";
@@ -368,11 +370,8 @@ export const useSQLEditorTabStore = defineStore("sqlEditorTab", () => {
watch(
() => project.value,
async (project) => {
- await migrateDraftsFromCache(project);
- migrateTabViewState(project);
- await maybeInitProject();
- },
- { immediate: true }
+ await initProject(project);
+ }
);
// some shortcuts
@@ -384,6 +383,7 @@ export const useSQLEditorTabStore = defineStore("sqlEditorTab", () => {
return {
project,
+ initProject,
getTabById,
openTabList,
currentTabId,