Skip to content

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

chore: add oracle/redis proto (#4923)

Danny Xua5f1b6cfabff
diff --git a/backend/api/v1/common.go b/backend/api/v1/common.go
index 5a4b6c32a4..1af3981085 100644
--- a/backend/api/v1/common.go
+++ b/backend/api/v1/common.go
@@ -227,6 +227,10 @@ func convertToEngine(engine db.Type) v1pb.Engine {
return v1pb.Engine_TIDB
case db.MongoDB:
return v1pb.Engine_MONGODB
+ case db.Redis:
+ return v1pb.Engine_REDIS
+ case db.Oracle:
+ return v1pb.Engine_ORACLE
}
return v1pb.Engine_ENGINE_UNSPECIFIED
}
@@ -247,6 +251,10 @@ func convertEngine(engine v1pb.Engine) db.Type {
return db.TiDB
case v1pb.Engine_MONGODB:
return db.MongoDB
+ case v1pb.Engine_REDIS:
+ return db.Redis
+ case v1pb.Engine_ORACLE:
+ return db.Oracle
}
return db.UnknownType
}
diff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.go
index 1da10858d4..f95855144d 100644
--- a/backend/plugin/db/driver.go
+++ b/backend/plugin/db/driver.go
@@ -38,6 +38,10 @@ const (
MongoDB Type = "MONGODB"
// Spanner is the database type for Spanner.
Spanner Type = "SPANNER"
+ // Redis is the database type for Redis.
+ Redis Type = "REDIS"
+ // Oracle is the database type for Oracle.
+ Oracle Type = "ORACLE"
// UnknownType is the database type for UNKNOWN.
UnknownType Type = "UNKNOWN"
diff --git a/backend/plugin/db/spanner/migrate.go b/backend/plugin/db/spanner/migrate.go
index 62ace30056..f0412ebda9 100644
--- a/backend/plugin/db/spanner/migrate.go
+++ b/backend/plugin/db/spanner/migrate.go
@@ -220,7 +220,6 @@ func (d *Driver) beginMigration(ctx context.Context, m *db.MigrationInfo, prevSc
if version, err := d.findLargestVersionSinceBaseline(ctx, tx, m.Namespace); err != nil {
return "", err
} else if version != nil && len(*version) > 0 && *version >= m.Version {
- // len(*version) > 0 is used because Clickhouse will always return non-nil version with empty string.
return "", common.Errorf(common.MigrationOutOfOrder, "database %q has already applied version %s which >= %s", m.Database, *version, m.Version)
}
diff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.go
index 02cf915057..89bae7fefa 100644
--- a/backend/plugin/db/util/driverutil.go
+++ b/backend/plugin/db/util/driverutil.go
@@ -380,7 +380,7 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string
// Clickhouse doesn't support READ ONLY transactions (Error: sql: driver does not support read-only transactions).
// Snowflake doesn't support READ ONLY transactions.
// https://github.com/snowflakedb/gosnowflake/blob/0450f0b16a4679b216baecd3fd6cdce739dbb683/connection.go#L166
- if dbType == db.TiDB || dbType == db.ClickHouse || dbType == db.Snowflake {
+ if dbType == db.TiDB || dbType == db.ClickHouse || dbType == db.Snowflake || dbType == db.Spanner || dbType == db.Redis || dbType == db.Oracle {
readOnly = false
}
tx, err := conn.BeginTx(ctx, &sql.TxOptions{ReadOnly: readOnly})
diff --git a/backend/runner/anomaly/scanner.go b/backend/runner/anomaly/scanner.go
index 4ff8c5f7cc..e7ff62f0c3 100644
--- a/backend/runner/anomaly/scanner.go
+++ b/backend/runner/anomaly/scanner.go
@@ -364,8 +364,8 @@ func (s *Scanner) checkDatabaseAnomaly(ctx context.Context, instance *store.Inst
}
func (s *Scanner) checkBackupAnomaly(ctx context.Context, environment *store.EnvironmentMessage, instance *store.InstanceMessage, database *store.DatabaseMessage, policyMap map[int]*api.BackupPlanPolicy) {
- if instance.Engine == db.MongoDB || instance.Engine == db.Spanner {
- // skip checking backup anomalies for MongoDB and Spanner because they don't support Backup.
+ if instance.Engine == db.MongoDB || instance.Engine == db.Spanner || instance.Engine == db.Redis || instance.Engine == db.Oracle {
+ // skip checking backup anomalies for MongoDB, Spanner, Redis, Oracle because they don't support Backup.
return
}
diff --git a/backend/runner/backuprun/runner.go b/backend/runner/backuprun/runner.go
index bcb526bb1b..e6f95e5d2d 100644
--- a/backend/runner/backuprun/runner.go
+++ b/backend/runner/backuprun/runner.go
@@ -342,8 +342,8 @@ func (r *Runner) startAutoBackups(ctx context.Context) {
if instance.Deleted {
continue
}
- // backup for Spanner is not supported.
- if instance.Engine == db.Spanner {
+ // backup for ClickHouse, Snowflake, MongoDB, Spanner, Redis, Oracle is not supported.
+ if instance.Engine == db.ClickHouse || instance.Engine == db.Snowflake || instance.Engine == db.MongoDB || instance.Engine == db.Spanner || instance.Engine == db.Redis || instance.Engine == db.Oracle {
continue
}
environment, err := r.store.GetEnvironmentV2(ctx, &store.FindEnvironmentMessage{ResourceID: &instance.EnvironmentID})
diff --git a/backend/server/issue.go b/backend/server/issue.go
index 383119a732..2cdb58f912 100644
--- a/backend/server/issue.go
+++ b/backend/server/issue.go
@@ -1243,6 +1243,8 @@ func getCreateDatabaseStatement(dbType db.Type, createDatabaseContext api.Create
return fmt.Sprintf(`db.createCollection("%s");`, createDatabaseContext.TableName), nil
case db.Spanner:
return fmt.Sprintf("CREATE DATABASE %s", databaseName), nil
+ case db.Oracle:
+ return fmt.Sprintf("CREATE DATABASE %s", databaseName), nil
}
return "", errors.Errorf("unsupported database type %s", dbType)
}
diff --git a/frontend/src/types/proto/v1/common.ts b/frontend/src/types/proto/v1/common.ts
index 56965ba294..e95d93189d 100644
--- a/frontend/src/types/proto/v1/common.ts
+++ b/frontend/src/types/proto/v1/common.ts
@@ -50,6 +50,8 @@ export enum Engine {
SQLITE = 5,
TIDB = 6,
MONGODB = 7,
+ REDIS = 8,
+ ORACLE = 9,
UNRECOGNIZED = -1,
}
@@ -79,6 +81,12 @@ export function engineFromJSON(object: any): Engine {
case 7:
case "MONGODB":
return Engine.MONGODB;
+ case 8:
+ case "REDIS":
+ return Engine.REDIS;
+ case 9:
+ case "ORACLE":
+ return Engine.ORACLE;
case -1:
case "UNRECOGNIZED":
default:
@@ -104,6 +112,10 @@ export function engineToJSON(object: Engine): string {
return "TIDB";
case Engine.MONGODB:
return "MONGODB";
+ case Engine.REDIS:
+ return "REDIS";
+ case Engine.ORACLE:
+ return "ORACLE";
case Engine.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
diff --git a/proto/generated-go/v1/common.pb.go b/proto/generated-go/v1/common.pb.go
index cf142406dc..daa9f36455 100644
--- a/proto/generated-go/v1/common.pb.go
+++ b/proto/generated-go/v1/common.pb.go
@@ -80,6 +80,8 @@ const (
Engine_SQLITE Engine = 5
Engine_TIDB Engine = 6
Engine_MONGODB Engine = 7
+ Engine_REDIS Engine = 8
+ Engine_ORACLE Engine = 9
)
// Enum value maps for Engine.
@@ -93,6 +95,8 @@ var (
5: "SQLITE",
6: "TIDB",
7: "MONGODB",
+ 8: "REDIS",
+ 9: "ORACLE",
}
Engine_value = map[string]int32{
"ENGINE_UNSPECIFIED": 0,
@@ -103,6 +107,8 @@ var (
"SQLITE": 5,
"TIDB": 6,
"MONGODB": 7,
+ "REDIS": 8,
+ "ORACLE": 9,
}
)
@@ -141,16 +147,18 @@ var file_v1_common_proto_rawDesc = []byte{
0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x45,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a,
0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45,
- 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x7b, 0x0a, 0x06, 0x45, 0x6e, 0x67, 0x69, 0x6e,
- 0x65, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,
- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x4c, 0x49,
- 0x43, 0x4b, 0x48, 0x4f, 0x55, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x59, 0x53,
- 0x51, 0x4c, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53,
- 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x4e, 0x4f, 0x57, 0x46, 0x4c, 0x41, 0x4b, 0x45, 0x10,
- 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x51, 0x4c, 0x49, 0x54, 0x45, 0x10, 0x05, 0x12, 0x08, 0x0a,
- 0x04, 0x54, 0x49, 0x44, 0x42, 0x10, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x4f, 0x4e, 0x47, 0x4f,
- 0x44, 0x42, 0x10, 0x07, 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,
+ 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x92, 0x01, 0x0a, 0x06, 0x45, 0x6e, 0x67, 0x69,
+ 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x55, 0x4e, 0x53,
+ 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x4c,
+ 0x49, 0x43, 0x4b, 0x48, 0x4f, 0x55, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x59,
+ 0x53, 0x51, 0x4c, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45,
+ 0x53, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x4e, 0x4f, 0x57, 0x46, 0x4c, 0x41, 0x4b, 0x45,
+ 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x51, 0x4c, 0x49, 0x54, 0x45, 0x10, 0x05, 0x12, 0x08,
+ 0x0a, 0x04, 0x54, 0x49, 0x44, 0x42, 0x10, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x4f, 0x4e, 0x47,
+ 0x4f, 0x44, 0x42, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x44, 0x49, 0x53, 0x10, 0x08,
+ 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x52, 0x41, 0x43, 0x4c, 0x45, 0x10, 0x09, 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/common.proto b/proto/v1/common.proto
index 654d1dd747..81f9594906 100644
--- a/proto/v1/common.proto
+++ b/proto/v1/common.proto
@@ -19,4 +19,6 @@ enum Engine {
SQLITE = 5;
TIDB = 6;
MONGODB = 7;
+ REDIS = 8;
+ ORACLE = 9;
}