Skip to content

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

feat(gh-ost): issue api definition (#1116)

p0ny01fd5a17378b
diff --git a/api/issue.go b/api/issue.go
index 61813f7d58..099bd5c198 100644
--- a/api/issue.go
+++ b/api/issue.go
@@ -31,6 +31,8 @@ const (
IssueDatabaseGrant IssueType = "bb.issue.database.grant"
// IssueDatabaseSchemaUpdate is the issue type for updating database schemas (DDL).
IssueDatabaseSchemaUpdate IssueType = "bb.issue.database.schema.update"
+ // IssueDatabaseSchemaUpdateGhost is the issue type for updating database schemas using gh-ost.
+ IssueDatabaseSchemaUpdateGhost IssueType = "bb.issue.database.schema.update.ghost"
// IssueDatabaseDataUpdate is the issue type for updating database data (DML).
IssueDatabaseDataUpdate IssueType = "bb.issue.database.data.update"
// IssueDataSourceRequest is the issue type for requesting database sources.
@@ -206,6 +208,28 @@ type UpdateSchemaContext struct {
VCSPushEvent *vcs.PushEvent
}
+// UpdateSchemaGhostDetail is the detail of updating database schema using gh-ost
+type UpdateSchemaGhostDetail struct {
+ // DatabaseID is the ID of a database.
+ DatabaseID int `json:"databaseId"`
+ // DatabaseName is the name of databases, mutually exclusive to DatabaseID.
+ // This should be set when a project is in tenant mode, and ProjectID is derived from IssueCreate.
+ DatabaseName string `json:"databaseName"`
+ // Statement is the statement to update database schema.
+ Statement string `json:"statement"`
+ // EarliestAllowedTs the earliest execution time of the change at system local Unix timestamp in seconds.
+ EarliestAllowedTs int64 `jsonapi:"attr,earliestAllowedTs"`
+}
+
+// UpdateSchemaGhostContext is the issue create context for updating database schema using gh-ost.
+type UpdateSchemaGhostContext struct {
+ // UpdateSchemaDetail is the details of schema update.
+ // When a project is in tenant mode, there should be one item in the list.
+ UpdateSchemaDetailList []*UpdateSchemaDetail `json:"updateSchemaDetailList"`
+ // VCSPushEvent is the event information for VCS push.
+ VCSPushEvent *vcs.PushEvent
+}
+
// IssueFind is the API message for finding issues.
type IssueFind struct {
ID *int