Skip to content

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

chore: only allow to create child branches from main (parent-less) branches (#10243)

Liu Ji7a8f64dcaf57
diff --git a/frontend/src/components/Branch/BranchCreateView.vue b/frontend/src/components/Branch/BranchCreateView.vue
index 3d8b6f7c70..25423fb4c0 100644
--- a/frontend/src/components/Branch/BranchCreateView.vue
+++ b/frontend/src/components/Branch/BranchCreateView.vue
@@ -42,6 +42,7 @@
v-model:branch="parentBranchName"
:project="project"
:loading="isPreparingBranch"
+ :filter="filterParentBranch"
class=""
clearable
/>
@@ -99,6 +100,7 @@ import { Branch } from "@/types/proto/v1/branch_service";
import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
import { projectV1Slug } from "@/utils";
import BaselineSchemaSelector from "./BaselineSchemaSelector.vue";
+import BranchSelector from "./BranchSelector.vue";
import { validateBranchName } from "./utils";
type Source = "PARENT" | "BASELINE";
@@ -139,6 +141,11 @@ const project = computed(() => {
const debouncedDatabaseId = useDebounce(databaseId, DEBOUNCE_RATE);
const debouncedParentBranchName = useDebounce(parentBranchName, DEBOUNCE_RATE);
+const filterParentBranch = (branch: Branch) => {
+ // Only "main branch" aka parent-less branches can be parents.
+ return !!branch.parentBranch;
+};
+
const nextFakeBranchName = () => {
return `${project.value.name}/branches/-${uniqueId()}`;
};