Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: remove database from old project map when transferred (#6149)
Liu Jiab45997d998b
diff --git a/frontend/src/components/TransferDatabaseForm.vue b/frontend/src/components/TransferDatabaseForm.vueindex 34dca39443..8b4d7a60dc 100644--- a/frontend/src/components/TransferDatabaseForm.vue+++ b/frontend/src/components/TransferDatabaseForm.vue@@ -142,7 +142,7 @@ const transferDatabase = async (databaseList: Database[]) => {labels?: DatabaseLabel[]) => {return databaseStore.transferProject({- databaseId: database.id,+ database,projectId: props.projectId,labels, // Will keep all labels if not specified here});diff --git a/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vue b/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vueindex d11cc3e052..21cce1155d 100644--- a/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vue+++ b/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vue@@ -188,7 +188,7 @@ const doTransfer = async () => {const transferOneDatabase = (database: Database) => {return databaseStore.transferProject({- databaseId: database.id,+ database,projectId: target.uid,});};diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex bedf08531f..424b90c9b6 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -237,6 +237,21 @@ export const useDatabaseStore = defineStore("database", {}) {this.databaseListByProjectId.set(projectId, databaseList);},+ removeDatabaseListFromProject(databaseList: Database[]) {+ for (const database of databaseList) {+ const listByProject = this.databaseListByProjectId.get(+ database.project.id+ );+ if (listByProject) {+ const i = listByProject.findIndex(+ (item: Database) => item.id == database.id+ );+ if (i >= 0) {+ listByProject.splice(i, 1);+ }+ }+ }+ },upsertDatabaseList({databaseList,instanceId,@@ -386,11 +401,11 @@ export const useDatabaseStore = defineStore("database", {return schema;},async transferProject({- databaseId,+ database,projectId,labels,}: {- databaseId: DatabaseId;+ database: Database;projectId: string;labels?: DatabaseLabel[];}) {@@ -399,7 +414,7 @@ export const useDatabaseStore = defineStore("database", {attributes.labels = JSON.stringify(labels);}const data = (- await axios.patch(`/api/database/${databaseId}`, {+ await axios.patch(`/api/database/${database.id}`, {data: {type: "databasePatch",attributes,@@ -408,7 +423,7 @@ export const useDatabaseStore = defineStore("database", {).data;const updatedDatabase = convert(data.data, data.included);-+ this.removeDatabaseListFromProject([database]);this.upsertDatabaseList({databaseList: [updatedDatabase],});diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vueindex f80da482cf..74a982e98f 100644--- a/frontend/src/views/DatabaseDetail.vue+++ b/frontend/src/views/DatabaseDetail.vue@@ -680,7 +680,7 @@ const createMigration = async (const updateProject = (newProjectId: string, labels?: DatabaseLabel[]) => {databaseStore.transferProject({- databaseId: database.value.id,+ database: database.value,projectId: newProjectId,labels,})