Skip to content

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

chore: sync schema disable sdl format dump (#8601)

zll60077f2a4a9087c
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index d85d593a55..d04b4244c4 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -1003,7 +1003,7 @@ func (s *DatabaseService) getSourceSchema(ctx context.Context, request *v1pb.Dif
databaseSchema, err := s.GetDatabaseSchema(ctx, &v1pb.GetDatabaseSchemaRequest{
Name: fmt.Sprintf("%s/schema", request.Name),
- SdlFormat: true,
+ SdlFormat: request.SdlFormat,
})
if err != nil {
return "", err
diff --git a/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts b/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
index 454ccdf5f8..f9cda0cd71 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
+++ b/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
@@ -83,6 +83,7 @@ export const useSDLState = () => {
const { diff } = await databaseStore.diffSchema({
name: database.name,
schema: expectedSDL,
+ sdlFormat: true,
});
return diff ?? "";
};
diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.ts
index 5c7aa16636..dbf586bd8a 100644
--- a/frontend/src/types/proto/v1/database_service.ts
+++ b/frontend/src/types/proto/v1/database_service.ts
@@ -233,7 +233,11 @@ export interface DiffSchemaRequest {
* The resource name of the change history
* Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory}
*/
- changeHistory?: string | undefined;
+ changeHistory?:
+ | string
+ | undefined;
+ /** Format the schema dump into SDL format. */
+ sdlFormat: boolean;
}
export interface DiffSchemaResponse {
@@ -2266,7 +2270,7 @@ export const GetDatabaseSchemaRequest = {
};
function createBaseDiffSchemaRequest(): DiffSchemaRequest {
- return { name: "", schema: undefined, changeHistory: undefined };
+ return { name: "", schema: undefined, changeHistory: undefined, sdlFormat: false };
}
export const DiffSchemaRequest = {
@@ -2280,6 +2284,9 @@ export const DiffSchemaRequest = {
if (message.changeHistory !== undefined) {
writer.uint32(26).string(message.changeHistory);
}
+ if (message.sdlFormat === true) {
+ writer.uint32(32).bool(message.sdlFormat);
+ }
return writer;
},
@@ -2311,6 +2318,13 @@ export const DiffSchemaRequest = {
message.changeHistory = reader.string();
continue;
+ case 4:
+ if (tag !== 32) {
+ break;
+ }
+
+ message.sdlFormat = reader.bool();
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -2325,6 +2339,7 @@ export const DiffSchemaRequest = {
name: isSet(object.name) ? String(object.name) : "",
schema: isSet(object.schema) ? String(object.schema) : undefined,
changeHistory: isSet(object.changeHistory) ? String(object.changeHistory) : undefined,
+ sdlFormat: isSet(object.sdlFormat) ? Boolean(object.sdlFormat) : false,
};
},
@@ -2333,6 +2348,7 @@ export const DiffSchemaRequest = {
message.name !== undefined && (obj.name = message.name);
message.schema !== undefined && (obj.schema = message.schema);
message.changeHistory !== undefined && (obj.changeHistory = message.changeHistory);
+ message.sdlFormat !== undefined && (obj.sdlFormat = message.sdlFormat);
return obj;
},
@@ -2345,6 +2361,7 @@ export const DiffSchemaRequest = {
message.name = object.name ?? "";
message.schema = object.schema ?? undefined;
message.changeHistory = object.changeHistory ?? undefined;
+ message.sdlFormat = object.sdlFormat ?? false;
return message;
},
};
diff --git a/frontend/src/views/SyncDatabaseSchema/SelectTargetDatabasesView.vue b/frontend/src/views/SyncDatabaseSchema/SelectTargetDatabasesView.vue
index ecbdb909bf..9ba227fe45 100644
--- a/frontend/src/views/SyncDatabaseSchema/SelectTargetDatabasesView.vue
+++ b/frontend/src/views/SyncDatabaseSchema/SelectTargetDatabasesView.vue
@@ -561,6 +561,7 @@ watch(
const diffResp = await databaseStore.diffSchema({
name: db.name,
schema: sourceDatabaseSchema.value,
+ sdlFormat: false,
});
const schemaDiff = diffResp.diff ?? "";
databaseDiffCache[id] = {
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 457b58c6dd..aa62ada11f 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2764,6 +2764,7 @@ DependentColumn is the metadata for dependent columns.
| name | [string](#string) | | The name of the database or change history. Format: database: instances/{instance}/databases/{database} change history: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |
| schema | [string](#string) | | The target schema. |
| change_history | [string](#string) | | The resource name of the change history Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |
+| sdl_format | [bool](#bool) | | Format the schema dump into SDL format. |
diff --git a/proto/generated-go/v1/database_service.pb.go b/proto/generated-go/v1/database_service.pb.go
index f4634d72f0..db6ac162e7 100644
--- a/proto/generated-go/v1/database_service.pb.go
+++ b/proto/generated-go/v1/database_service.pb.go
@@ -1276,6 +1276,8 @@ type DiffSchemaRequest struct {
// *DiffSchemaRequest_Schema
// *DiffSchemaRequest_ChangeHistory
Target isDiffSchemaRequest_Target `protobuf_oneof:"target"`
+ // Format the schema dump into SDL format.
+ SdlFormat bool `protobuf:"varint,4,opt,name=sdl_format,json=sdlFormat,proto3" json:"sdl_format,omitempty"`
}
func (x *DiffSchemaRequest) Reset() {
@@ -1338,6 +1340,13 @@ func (x *DiffSchemaRequest) GetChangeHistory() string {
return ""
}
+func (x *DiffSchemaRequest) GetSdlFormat() bool {
+ if x != nil {
+ return x.SdlFormat
+ }
+ return false
+}
+
type isDiffSchemaRequest_Target interface {
isDiffSchemaRequest_Target()
}
@@ -5107,14 +5116,16 @@ var file_v1_database_service_proto_rawDesc = []byte{
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x64, 0x6c, 0x5f, 0x66, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x64, 0x6c, 0x46,
- 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x79, 0x0a, 0x11, 0x44, 0x69, 0x66, 0x66, 0x53, 0x63, 0x68,
- 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a,
- 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18,
- 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48,
- 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x66, 0x66, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27,
+ 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
+ 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x64, 0x6c, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x64, 0x6c,
+ 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x22, 0x28, 0x0a, 0x12, 0x44, 0x69, 0x66, 0x66, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x69, 0x66, 0x66, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x69, 0x66, 0x66, 0x22, 0x32, 0x0a, 0x17, 0x47, 0x65,
diff --git a/proto/v1/database_service.proto b/proto/v1/database_service.proto
index 02b284300e..74038727ae 100644
--- a/proto/v1/database_service.proto
+++ b/proto/v1/database_service.proto
@@ -285,6 +285,9 @@ message DiffSchemaRequest {
// Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory}
string change_history = 3;
}
+
+ // Format the schema dump into SDL format.
+ bool sdl_format = 4;
}
message DiffSchemaResponse {