Skip to content

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

chore: fix create branch (#9672)

Danny Xu906fd02b48cd
diff --git a/backend/common/resource_name.go b/backend/common/resource_name.go
index a7087992f9..3dfa3d1dc2 100644
--- a/backend/common/resource_name.go
+++ b/backend/common/resource_name.go
@@ -42,7 +42,6 @@ const (
PipelineNamePrefix = "pipelines/"
LogNamePrefix = "logs/"
InboxNamePrefix = "inbox/"
- SchemaDesignPrefix = "schemaDesigns/"
BranchPrefix = "branches/"
DeploymentConfigPrefix = "deploymentConfigs/"
ChangelistsPrefix = "changelists/"
@@ -473,15 +472,6 @@ func GetProjectResourceIDSheetUID(name string) (string, int, error) {
return tokens[0], sheetUID, nil
}
-// GetProjectResourceIDAndSchemaDesignSheetID returns the project ID and schema design sheet ID from a resource name.
-func GetProjectResourceIDAndSchemaDesignSheetID(name string) (string, string, error) {
- tokens, err := GetNameParentTokens(name, ProjectNamePrefix, SchemaDesignPrefix)
- if err != nil {
- return "", "", err
- }
- return tokens[0], tokens[1], nil
-}
-
// GetProjectAndBranchID returns the project and branch ID from a resource name.
func GetProjectAndBranchID(name string) (string, string, error) {
tokens, err := GetNameParentTokens(name, ProjectNamePrefix, BranchPrefix)
diff --git a/frontend/src/components/Branch/BranchCreateView.vue b/frontend/src/components/Branch/BranchCreateView.vue
index 9b7460ac88..221f409a3b 100644
--- a/frontend/src/components/Branch/BranchCreateView.vue
+++ b/frontend/src/components/Branch/BranchCreateView.vue
@@ -276,8 +276,7 @@ const handleConfirm = async () => {
}
state.isCreating = true;
- const baselineDatabase = `${database.instanceEntity.name}/${databaseNamePrefix}${state.baselineSchema.databaseId}`;
-
+ const baselineDatabase = `${database.instanceEntity.name}/${databaseNamePrefix}${database.databaseName}`;
let createdSchemaDesign;
if (!state.parentBranchName) {
createdSchemaDesign = await branchStore.createBranch(
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 1a25b74769..4f417534af 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -1242,7 +1242,7 @@ router.beforeEach((to, from, next) => {
to.name === "workspace.project.branch.detail" &&
to.params.branchName !== "new"
) {
- const name = `${project.name}/schemaDesigns/${to.params.branchName}`;
+ const name = `${project.name}/branches/${to.params.branchName}`;
useBranchStore()
.fetchBranchByName(name, false /* !useCache */)
.then((branch) => {
diff --git a/frontend/src/store/modules/branch.ts b/frontend/src/store/modules/branch.ts
index 4bc2a7e1ed..7ed8084759 100644
--- a/frontend/src/store/modules/branch.ts
+++ b/frontend/src/store/modules/branch.ts
@@ -26,7 +26,6 @@ export const useBranchStore = defineStore("schema_design", () => {
branchId: string,
branch: Branch
) => {
- console.log("Barny1: ", parent, branchId, branch);
const createdBranch = await branchServiceClient.createBranch({
parent: projectResourceId,
branchId: branchId,
diff --git a/frontend/src/types/proto/store/changelist.ts b/frontend/src/types/proto/store/changelist.ts
index fdb9c20326..e7ed62f3a0 100644
--- a/frontend/src/types/proto/store/changelist.ts
+++ b/frontend/src/types/proto/store/changelist.ts
@@ -15,7 +15,7 @@ export interface Changelist_Change {
/**
* The source of origin.
* 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- * 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ * 2) branch: projects/{project}/branches/{branch}.
* 3) raw SQL if empty.
*/
source: string;
diff --git a/frontend/src/types/proto/v1/changelist_service.ts b/frontend/src/types/proto/v1/changelist_service.ts
index f3f7dba945..26e3cddedc 100644
--- a/frontend/src/types/proto/v1/changelist_service.ts
+++ b/frontend/src/types/proto/v1/changelist_service.ts
@@ -124,7 +124,7 @@ export interface Changelist_Change {
/**
* The source of origin.
* 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- * 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ * 2) branch: projects/{project}/branches/{branch}.
* 3) raw SQL if empty.
*/
source: string;
diff --git a/frontend/src/utils/v1/changelist.ts b/frontend/src/utils/v1/changelist.ts
index 00e3dd8bc7..972a96ac5d 100644
--- a/frontend/src/utils/v1/changelist.ts
+++ b/frontend/src/utils/v1/changelist.ts
@@ -14,7 +14,7 @@ export const isChangeHistoryChangeSource = (change: Change) => {
return change.source.match(/(^|\/)changeHistories\//);
};
export const isBranchChangeSource = (change: Change) => {
- return change.source.match(/(^|\/)schemaDesigns\//);
+ return change.source.match(/(^|\/)branches\//);
};
export const getChangelistChangeSourceType = (
diff --git a/frontend/src/views/branch/BranchDetail.vue b/frontend/src/views/branch/BranchDetail.vue
index 0bb523fc7c..84d680c15f 100644
--- a/frontend/src/views/branch/BranchDetail.vue
+++ b/frontend/src/views/branch/BranchDetail.vue
@@ -52,7 +52,7 @@ watch(
if (!sheetId || !project.value) {
return;
}
- branchFullName.value = `${project.value.name}/schemaDesigns/${sheetId}`;
+ branchFullName.value = `${project.value.name}/branches/${sheetId}`;
},
{
immediate: true,
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 263ee7c9ee..fe99b2e0a3 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -1131,7 +1131,7 @@ ViewMetadata is the metadata for views.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sheet | [string](#string) | | The name of a sheet. |
-| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/schemaDesigns/{schemaDesign}. 3) raw SQL if empty. |
+| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/branches/{branch}. 3) raw SQL if empty. |
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 17744324e3..a7dcc3cb29 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -3752,7 +3752,7 @@ The branch's `name` field is used to identify the branch to update. Format:
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sheet | [string](#string) | | The name of a sheet. |
-| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/schemaDesigns/{schemaDesign}. 3) raw SQL if empty. |
+| source | [string](#string) | | The source of origin. 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}. 2) branch: projects/{project}/branches/{branch}. 3) raw SQL if empty. |
diff --git a/proto/generated-go/store/changelist.pb.go b/proto/generated-go/store/changelist.pb.go
index bf0f850750..c2e5012413 100644
--- a/proto/generated-go/store/changelist.pb.go
+++ b/proto/generated-go/store/changelist.pb.go
@@ -84,7 +84,7 @@ type Changelist_Change struct {
Sheet string `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
// The source of origin.
// 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- // 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ // 2) branch: projects/{project}/branches/{branch}.
// 3) raw SQL if empty.
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
}
diff --git a/proto/generated-go/v1/changelist_service.pb.go b/proto/generated-go/v1/changelist_service.pb.go
index b01739738c..af957a61d6 100644
--- a/proto/generated-go/v1/changelist_service.pb.go
+++ b/proto/generated-go/v1/changelist_service.pb.go
@@ -499,7 +499,7 @@ type Changelist_Change struct {
Sheet string `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
// The source of origin.
// 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- // 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ // 2) branch: projects/{project}/branches/{branch}.
// 3) raw SQL if empty.
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
}
diff --git a/proto/store/changelist.proto b/proto/store/changelist.proto
index 3fd6484887..c48c182505 100644
--- a/proto/store/changelist.proto
+++ b/proto/store/changelist.proto
@@ -12,7 +12,7 @@ message Changelist {
string sheet = 1;
// The source of origin.
// 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- // 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ // 2) branch: projects/{project}/branches/{branch}.
// 3) raw SQL if empty.
string source = 2;
}
diff --git a/proto/v1/changelist_service.proto b/proto/v1/changelist_service.proto
index ab34d46285..909e169d38 100644
--- a/proto/v1/changelist_service.proto
+++ b/proto/v1/changelist_service.proto
@@ -142,7 +142,7 @@ message Changelist {
string sheet = 1;
// The source of origin.
// 1) change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory}.
- // 2) branch: projects/{project}/schemaDesigns/{schemaDesign}.
+ // 2) branch: projects/{project}/branches/{branch}.
// 3) raw SQL if empty.
string source = 2;
}