Skip to content

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

fix: patch project.workflowType after deleting its repository (#4493)

Liu Ji2326b213ebfe
diff --git a/frontend/src/components/ProjectVersionControlPanel.vue b/frontend/src/components/ProjectVersionControlPanel.vue
index 342332c2d6..4d602a0222 100644
--- a/frontend/src/components/ProjectVersionControlPanel.vue
+++ b/frontend/src/components/ProjectVersionControlPanel.vue
@@ -134,9 +134,9 @@ export default defineComponent({
watchEffect(prepareRepository);
watch(
- () => props.project,
- (cur) => {
- state.workflowType = cur.workflowType;
+ () => props.project.workflowType,
+ (type) => {
+ state.workflowType = type;
}
);
diff --git a/frontend/src/components/RepositoryPanel.vue b/frontend/src/components/RepositoryPanel.vue
index 338f6ce189..525b36cf64 100644
--- a/frontend/src/components/RepositoryPanel.vue
+++ b/frontend/src/components/RepositoryPanel.vue
@@ -284,6 +284,7 @@ export default defineComponent({
setup(props) {
const { t } = useI18n();
const repositoryStore = useRepositoryStore();
+ const projectStore = useProjectStore();
const state = reactive<LocalState>({
repositoryConfig: {
baseDirectory: props.repository.baseDirectory,
@@ -358,17 +359,22 @@ export default defineComponent({
restoreToUIWorkflowType(false);
};
- const restoreToUIWorkflowType = (checkSQLReviewCI: boolean) => {
+ const restoreToUIWorkflowType = async (checkSQLReviewCI: boolean) => {
if (checkSQLReviewCI && props.repository.enableSQLReviewCI) {
state.showRestoreSQLReviewCIModal = true;
return;
}
- repositoryStore.deleteRepositoryByProjectId(props.project.id).then(() => {
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("repository.restore-ui-workflow-success"),
- });
+ await repositoryStore.deleteRepositoryByProjectId(props.project.id);
+ await projectStore.patchProject({
+ projectId: props.project.id,
+ projectPatch: {
+ workflowType: "UI",
+ },
+ });
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("repository.restore-ui-workflow-success"),
});
};
diff --git a/frontend/src/types/project.ts b/frontend/src/types/project.ts
index daa934f14d..c0a7089890 100644
--- a/frontend/src/types/project.ts
+++ b/frontend/src/types/project.ts
@@ -65,6 +65,7 @@ export type ProjectPatch = {
key?: string;
schemaChangeType?: SchemaChangeType;
lgtmCheckSetting?: LGTMCheckSetting;
+ workflowType?: ProjectWorkflowType;
dbNameTemplate?: string;
};