Skip to content

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

chore: add a release flag for lsp which controls the default value for lsp mode in SQL Editor (#9585)

Danny Xu74ddce4d1426
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
index 5240631857..50235b7747 100644
--- a/backend/api/v1/actuator_service.go
+++ b/backend/api/v1/actuator_service.go
@@ -111,6 +111,7 @@ func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfo
WorkspaceId: workspaceID,
GitopsWebhookUrl: setting.GitopsWebhookUrl,
Debug: slog.Default().Enabled(ctx, slog.LevelDebug),
+ Lsp: s.profile.Lsp,
}
return &serverInfo, nil
diff --git a/backend/bin/server/cmd/profile.go b/backend/bin/server/cmd/profile.go
index e0fc0a1109..3f7cbd3da4 100644
--- a/backend/bin/server/cmd/profile.go
+++ b/backend/bin/server/cmd/profile.go
@@ -38,5 +38,6 @@ func getBaseProfile(dataDir string) config.Profile {
BackupBucket: flags.backupBucket,
BackupCredentialFile: flags.backupCredential,
LastActiveTs: time.Now().Unix(),
+ Lsp: flags.lsp,
}
}
diff --git a/backend/bin/server/cmd/root.go b/backend/bin/server/cmd/root.go
index 307e45cc8c..d1ce8d01f3 100644
--- a/backend/bin/server/cmd/root.go
+++ b/backend/bin/server/cmd/root.go
@@ -80,6 +80,7 @@ var (
disableMetric bool
// disableSample is the flag to disable the sample instance.
disableSample bool
+ lsp bool
// Cloud backup configs.
backupRegion string
@@ -122,6 +123,7 @@ func init() {
// Must be one of the subpath name in the ../migrator/demo directory
rootCmd.PersistentFlags().StringVar(&flags.demoName, "demo", "", "name of the demo to use. Empty means not running in demo mode.")
rootCmd.PersistentFlags().BoolVar(&flags.debug, "debug", false, "whether to enable debug level logging")
+ rootCmd.PersistentFlags().BoolVar(&flags.lsp, "lsp", false, "whether to enable lsp in SQL Editor")
// Support environment variable for deploying to render.com using its blueprint file.
// Render blueprint allows to specify a postgres database along with a service.
// It allows to pass the postgres connection string as an ENV to the service.
diff --git a/backend/component/config/profile.go b/backend/component/config/profile.go
index f1454895c6..37105ee48a 100644
--- a/backend/component/config/profile.go
+++ b/backend/component/config/profile.go
@@ -32,6 +32,7 @@ type Profile struct {
Readonly bool
// When we are running in SaaS mode, some features are not allowed to edit by users.
SaaS bool
+ Lsp bool
// DataDir is the directory stores the data including Bytebase's own database, backups, etc.
DataDir string
// ResourceDir is the directory stores the resources including embedded postgres, mysqlutil, mongoutil and etc.
diff --git a/frontend/src/types/proto/v1/actuator_service.ts b/frontend/src/types/proto/v1/actuator_service.ts
index f9e57545ed..996c865921 100644
--- a/frontend/src/types/proto/v1/actuator_service.ts
+++ b/frontend/src/types/proto/v1/actuator_service.ts
@@ -95,6 +95,8 @@ export interface ActuatorInfo {
gitopsWebhookUrl: string;
/** debug flag means if the debug mode is enabled. */
debug: boolean;
+ /** lsp is the enablement of lsp in SQL Editor. */
+ lsp: boolean;
}
function createBaseGetActuatorInfoRequest(): GetActuatorInfoRequest {
@@ -543,6 +545,7 @@ function createBaseActuatorInfo(): ActuatorInfo {
workspaceId: "",
gitopsWebhookUrl: "",
debug: false,
+ lsp: false,
};
}
@@ -593,6 +596,9 @@ export const ActuatorInfo = {
if (message.debug === true) {
writer.uint32(120).bool(message.debug);
}
+ if (message.lsp === true) {
+ writer.uint32(128).bool(message.lsp);
+ }
return writer;
},
@@ -708,6 +714,13 @@ export const ActuatorInfo = {
message.debug = reader.bool();
continue;
+ case 16:
+ if (tag !== 128) {
+ break;
+ }
+
+ message.lsp = reader.bool();
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -734,6 +747,7 @@ export const ActuatorInfo = {
workspaceId: isSet(object.workspaceId) ? globalThis.String(object.workspaceId) : "",
gitopsWebhookUrl: isSet(object.gitopsWebhookUrl) ? globalThis.String(object.gitopsWebhookUrl) : "",
debug: isSet(object.debug) ? globalThis.Boolean(object.debug) : false,
+ lsp: isSet(object.lsp) ? globalThis.Boolean(object.lsp) : false,
};
},
@@ -784,6 +798,9 @@ export const ActuatorInfo = {
if (message.debug === true) {
obj.debug = message.debug;
}
+ if (message.lsp === true) {
+ obj.lsp = message.lsp;
+ }
return obj;
},
@@ -807,6 +824,7 @@ export const ActuatorInfo = {
message.workspaceId = object.workspaceId ?? "";
message.gitopsWebhookUrl = object.gitopsWebhookUrl ?? "";
message.debug = object.debug ?? false;
+ message.lsp = object.lsp ?? false;
return message;
},
};
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index f7be55854b..901f8faad4 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -664,6 +664,7 @@ Actuator concept is similar to the Spring Boot Actuator.
| workspace_id | [string](#string) | | workspace_id is the identifier for the workspace. |
| gitops_webhook_url | [string](#string) | | gitops_webhook_url is the webhook URL for GitOps. |
| debug | [bool](#bool) | | debug flag means if the debug mode is enabled. |
+| lsp | [bool](#bool) | | lsp is the enablement of lsp in SQL Editor. |
diff --git a/proto/generated-go/v1/actuator_service.pb.go b/proto/generated-go/v1/actuator_service.pb.go
index c5fc6954f6..34af38e52a 100644
--- a/proto/generated-go/v1/actuator_service.pb.go
+++ b/proto/generated-go/v1/actuator_service.pb.go
@@ -395,6 +395,8 @@ type ActuatorInfo struct {
GitopsWebhookUrl string `protobuf:"bytes,14,opt,name=gitops_webhook_url,json=gitopsWebhookUrl,proto3" json:"gitops_webhook_url,omitempty"`
// debug flag means if the debug mode is enabled.
Debug bool `protobuf:"varint,15,opt,name=debug,proto3" json:"debug,omitempty"`
+ // lsp is the enablement of lsp in SQL Editor.
+ Lsp bool `protobuf:"varint,16,opt,name=lsp,proto3" json:"lsp,omitempty"`
}
func (x *ActuatorInfo) Reset() {
@@ -534,6 +536,13 @@ func (x *ActuatorInfo) GetDebug() bool {
return false
}
+func (x *ActuatorInfo) GetLsp() bool {
+ if x != nil {
+ return x.Lsp
+ }
+ return false
+}
+
var File_v1_actuator_service_proto protoreflect.FileDescriptor
var file_v1_actuator_service_proto_rawDesc = []byte{
@@ -587,7 +596,7 @@ var file_v1_actuator_service_proto_rawDesc = []byte{
0x74, 0x61, 0x63, 0x6b, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x22, 0x14, 0x0a, 0x12,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x22, 0xc6, 0x04, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49,
+ 0x73, 0x74, 0x22, 0xd8, 0x04, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0a, 0x67, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
@@ -623,40 +632,41 @@ var file_v1_actuator_service_proto_rawDesc = []byte{
0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,
0xe0, 0x41, 0x03, 0x52, 0x10, 0x67, 0x69, 0x74, 0x6f, 0x70, 0x73, 0x57, 0x65, 0x62, 0x68, 0x6f,
0x6f, 0x6b, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x0f,
- 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x32, 0xf0, 0x03, 0x0a, 0x0f,
- 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
- 0x6f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e,
- 0x66, 0x6f, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e,
- 0x66, 0x6f, 0x22, 0x1c, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f,
- 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f,
- 0x12, 0x93, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x75, 0x61,
- 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74, 0x75,
- 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63,
- 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x3a, 0xda, 0x41, 0x14, 0x61,
- 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d,
- 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x08, 0x61, 0x63, 0x74, 0x75, 0x61,
- 0x74, 0x6f, 0x72, 0x32, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f,
- 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x62, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
- 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75,
- 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x12, 0x72, 0x0a, 0x0c, 0x4c, 0x69,
- 0x73, 0x74, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74,
- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x62,
- 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x6c,
+ 0x73, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6c, 0x73, 0x70, 0x32, 0xf0, 0x03,
+ 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72,
+ 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
+ 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e,
+ 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72,
+ 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x1c, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12,
+ 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x69, 0x6e,
+ 0x66, 0x6f, 0x12, 0x93, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x74,
+ 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63,
+ 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x3a, 0xda, 0x41,
+ 0x14, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x08, 0x61, 0x63, 0x74,
+ 0x75, 0x61, 0x74, 0x6f, 0x72, 0x32, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61,
+ 0x74, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x62, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68,
+ 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
+ 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63,
+ 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x12, 0x72, 0x0a, 0x0c,
+ 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x12, 0x20, 0x2e, 0x62,
0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44,
- 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
- 0x1d, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f,
- 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x42, 0x11,
- 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76,
- 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
+ 0x74, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x22, 0x1d, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76,
+ 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67,
+ 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,
+ 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/v1/actuator_service.proto b/proto/v1/actuator_service.proto
index ff73c27cbb..430b25e41e 100644
--- a/proto/v1/actuator_service.proto
+++ b/proto/v1/actuator_service.proto
@@ -130,4 +130,7 @@ message ActuatorInfo {
// debug flag means if the debug mode is enabled.
bool debug = 15;
+
+ // lsp is the enablement of lsp in SQL Editor.
+ bool lsp = 16;
}