Skip to content

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

feat: changelog filter (#14326)

p0ny367d380b388b
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index deae556f06..faee6aa7ab 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -749,9 +749,8 @@ func (s *DatabaseService) ListChangeHistories(ctx context.Context, request *v1pb
}
offset, err := parseLimitAndOffset(&pageSize{
- token: request.PageToken,
- limit: int(request.PageSize),
- // TODO:
+ token: request.PageToken,
+ limit: int(request.PageSize),
maximum: 1000,
})
if err != nil {
diff --git a/backend/api/v1/database_service_changelog.go b/backend/api/v1/database_service_changelog.go
index 7bfc30e546..9b240ba817 100644
--- a/backend/api/v1/database_service_changelog.go
+++ b/backend/api/v1/database_service_changelog.go
@@ -2,6 +2,7 @@ package v1
import (
"context"
+ "strings"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -54,13 +55,32 @@ func (s *DatabaseService) ListChangelogs(ctx context.Context, request *v1pb.List
}
limitPlusOne := offset.limit + 1
- // TODO(p0ny): support view and filter
+ // TODO(p0ny): support view.
find := &store.FindChangelogMessage{
DatabaseUID: &database.UID,
Limit: &limitPlusOne,
Offset: &offset.offset,
}
+ filters, err := ParseFilter(request.Filter)
+ if err != nil {
+ return nil, status.Error(codes.InvalidArgument, err.Error())
+ }
+ for _, expr := range filters {
+ if expr.Operator != ComparatorTypeEqual {
+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for filter`)
+ }
+ switch expr.Key {
+ case "type":
+ find.TypeList = strings.Split(expr.Value, " | ")
+ case "table":
+ resourcesFilter := expr.Value
+ find.ResourcesFilter = &resourcesFilter
+ default:
+ return nil, status.Errorf(codes.InvalidArgument, "invalid filter key %q", expr.Key)
+ }
+ }
+
changelogs, err := s.store.ListChangelogs(ctx, find)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list changelogs, errors: %v", err)
@@ -91,7 +111,7 @@ func (s *DatabaseService) GetChangelog(ctx context.Context, request *v1pb.GetCha
return nil, status.Error(codes.InvalidArgument, err.Error())
}
- // TODO(p0ny): support view and filter.
+ // TODO(p0ny): support view.
changelog, err := s.store.GetChangelog(ctx, changelogUID)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list changelogs, errors: %v", err)
diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.go
index 0e0a4f11b8..d0a7833b1f 100644
--- a/backend/runner/taskrun/executor.go
+++ b/backend/runner/taskrun/executor.go
@@ -552,6 +552,7 @@ func beginMigration(ctx context.Context, stores *store.Store, mi *db.MigrationIn
SyncHistoryId: 0,
Sheet: mc.sheetName,
Version: mc.version,
+ Type: convertTaskType(mc.task.Type),
},
}}, api.SystemBotID)
if err != nil {
@@ -672,3 +673,23 @@ func endMigration(ctx context.Context, storeInstance *store.Store, startedNs int
}
return storeInstance.UpdateInstanceChangeHistory(ctx, update)
}
+
+func convertTaskType(t api.TaskType) storepb.ChangelogTask_Type {
+ switch t {
+ case api.TaskDatabaseDataUpdate:
+ return storepb.ChangelogTask_DATA
+ case api.TaskDatabaseSchemaBaseline:
+ return storepb.ChangelogTask_BASELINE
+ case api.TaskDatabaseSchemaUpdate:
+ return storepb.ChangelogTask_MIGRATE
+ case api.TaskDatabaseSchemaUpdateSDL:
+ return storepb.ChangelogTask_MIGRATE_SDL
+ case api.TaskDatabaseSchemaUpdateGhostCutover, api.TaskDatabaseSchemaUpdateGhostSync:
+ return storepb.ChangelogTask_MIGRATE_GHOST
+
+ case api.TaskGeneral:
+ case api.TaskDatabaseCreate:
+ case api.TaskDatabaseDataExport:
+ }
+ return storepb.ChangelogTask_TYPE_UNSPECIFIED
+}
diff --git a/backend/store/changelog.go b/backend/store/changelog.go
index 1b5d953246..3b8d7d4963 100644
--- a/backend/store/changelog.go
+++ b/backend/store/changelog.go
@@ -28,6 +28,9 @@ type FindChangelogMessage struct {
UID *int64
DatabaseUID *int
+ TypeList []string
+ ResourcesFilter *string
+
Limit *int
Offset *int
}
@@ -129,6 +132,19 @@ func (s *Store) ListChangelogs(ctx context.Context, find *FindChangelogMessage)
if v := find.DatabaseUID; v != nil {
where, args = append(where, fmt.Sprintf("changelog.database_id = $%d", len(args)+1)), append(args, *v)
}
+ if v := find.ResourcesFilter; v != nil {
+ text, err := generateResourceFilter(*v, "(changelog.payload->'task')")
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to generate resource filter from %q", *v)
+ }
+ if text != "" {
+ where = append(where, text)
+ }
+ }
+ if len(find.TypeList) > 0 {
+ where = append(where, fmt.Sprintf("changelog.payload->'task'->>'type' = ANY($%d)", len(args)+1))
+ args = append(args, find.TypeList)
+ }
query := fmt.Sprintf(`
SELECT
diff --git a/backend/store/instance_change_history.go b/backend/store/instance_change_history.go
index 7ade422298..5a80bc150b 100644
--- a/backend/store/instance_change_history.go
+++ b/backend/store/instance_change_history.go
@@ -264,7 +264,7 @@ type tableMap map[string]*resourceTable
//
// )
// .
-func generateResourceFilter(filter string) (string, error) {
+func generateResourceFilter(filter string, jsonbFieldName string) (string, error) {
env, err := cel.NewEnv(
cel.Declarations(
decls.NewFunction("tableExists", decls.NewOverload("tableExists_string", []*exprpb.Type{decls.String, decls.String, decls.String}, decls.Bool)),
@@ -313,7 +313,7 @@ func generateResourceFilter(filter string) (string, error) {
return "", err
}
}
- if _, err := buf.WriteString("(instance_change_history.payload @> '"); err != nil {
+ if _, err := buf.WriteString(fmt.Sprintf("(%s @> '", jsonbFieldName)); err != nil {
return "", err
}
if _, err := buf.WriteString(part); err != nil {
@@ -484,7 +484,7 @@ func (s *Store) ListInstanceChangeHistory(ctx context.Context, find *FindInstanc
where, args = append(where, fmt.Sprintf("instance_change_history.version = $%d", len(args)+1)), append(args, storedVersion)
}
if v := find.ResourcesFilter; v != nil {
- text, err := generateResourceFilter(*v)
+ text, err := generateResourceFilter(*v, "instance_change_history.payload")
if err != nil {
return nil, errors.Wrapf(err, "failed to generate resource filter from %q", *v)
}
diff --git a/backend/store/instance_change_history_test.go b/backend/store/instance_change_history_test.go
index 3f0de6520c..85f2e00f38 100644
--- a/backend/store/instance_change_history_test.go
+++ b/backend/store/instance_change_history_test.go
@@ -37,7 +37,7 @@ func TestGenerateResourceFilter(t *testing.T) {
}
for _, test := range tests {
- text, err := generateResourceFilter(test.filter)
+ text, err := generateResourceFilter(test.filter, "instance_change_history.payload")
require.NoError(t, err)
require.Equal(t, strings.ReplaceAll(test.expected, " ", ""), strings.ReplaceAll(text, " ", ""), test.filter)
}
diff --git a/frontend/src/types/proto/store/changelog.ts b/frontend/src/types/proto/store/changelog.ts
index 6946d370a9..2240da855b 100644
--- a/frontend/src/types/proto/store/changelog.ts
+++ b/frontend/src/types/proto/store/changelog.ts
@@ -17,9 +17,14 @@ export interface ChangelogPayload {
}
export interface ChangelogTask {
+ /** Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} */
taskRun: string;
+ /** Format: projects/{project}/issues/{issue} */
issue: string;
- /** optional */
+ /**
+ * The revision uid.
+ * optional
+ */
revision: Long;
changedResources: ChangedResources | undefined;
status: ChangelogTask_Status;
@@ -31,6 +36,7 @@ export interface ChangelogTask {
*/
sheet: string;
version: string;
+ type: ChangelogTask_Type;
}
export enum ChangelogTask_Status {
@@ -94,6 +100,83 @@ export function changelogTask_StatusToNumber(object: ChangelogTask_Status): numb
}
}
+export enum ChangelogTask_Type {
+ TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
+ BASELINE = "BASELINE",
+ MIGRATE = "MIGRATE",
+ MIGRATE_SDL = "MIGRATE_SDL",
+ MIGRATE_GHOST = "MIGRATE_GHOST",
+ DATA = "DATA",
+ UNRECOGNIZED = "UNRECOGNIZED",
+}
+
+export function changelogTask_TypeFromJSON(object: any): ChangelogTask_Type {
+ switch (object) {
+ case 0:
+ case "TYPE_UNSPECIFIED":
+ return ChangelogTask_Type.TYPE_UNSPECIFIED;
+ case 1:
+ case "BASELINE":
+ return ChangelogTask_Type.BASELINE;
+ case 2:
+ case "MIGRATE":
+ return ChangelogTask_Type.MIGRATE;
+ case 3:
+ case "MIGRATE_SDL":
+ return ChangelogTask_Type.MIGRATE_SDL;
+ case 4:
+ case "MIGRATE_GHOST":
+ return ChangelogTask_Type.MIGRATE_GHOST;
+ case 6:
+ case "DATA":
+ return ChangelogTask_Type.DATA;
+ case -1:
+ case "UNRECOGNIZED":
+ default:
+ return ChangelogTask_Type.UNRECOGNIZED;
+ }
+}
+
+export function changelogTask_TypeToJSON(object: ChangelogTask_Type): string {
+ switch (object) {
+ case ChangelogTask_Type.TYPE_UNSPECIFIED:
+ return "TYPE_UNSPECIFIED";
+ case ChangelogTask_Type.BASELINE:
+ return "BASELINE";
+ case ChangelogTask_Type.MIGRATE:
+ return "MIGRATE";
+ case ChangelogTask_Type.MIGRATE_SDL:
+ return "MIGRATE_SDL";
+ case ChangelogTask_Type.MIGRATE_GHOST:
+ return "MIGRATE_GHOST";
+ case ChangelogTask_Type.DATA:
+ return "DATA";
+ case ChangelogTask_Type.UNRECOGNIZED:
+ default:
+ return "UNRECOGNIZED";
+ }
+}
+
+export function changelogTask_TypeToNumber(object: ChangelogTask_Type): number {
+ switch (object) {
+ case ChangelogTask_Type.TYPE_UNSPECIFIED:
+ return 0;
+ case ChangelogTask_Type.BASELINE:
+ return 1;
+ case ChangelogTask_Type.MIGRATE:
+ return 2;
+ case ChangelogTask_Type.MIGRATE_SDL:
+ return 3;
+ case ChangelogTask_Type.MIGRATE_GHOST:
+ return 4;
+ case ChangelogTask_Type.DATA:
+ return 6;
+ case ChangelogTask_Type.UNRECOGNIZED:
+ default:
+ return -1;
+ }
+}
+
export interface ChangelogRevision {
/** Marshalled revision for display */
revision: string;
@@ -242,6 +325,7 @@ function createBaseChangelogTask(): ChangelogTask {
syncHistoryId: Long.ZERO,
sheet: "",
version: "",
+ type: ChangelogTask_Type.TYPE_UNSPECIFIED,
};
}
@@ -274,6 +358,9 @@ export const ChangelogTask: MessageFns<ChangelogTask> = {
if (message.version !== "") {
writer.uint32(74).string(message.version);
}
+ if (message.type !== ChangelogTask_Type.TYPE_UNSPECIFIED) {
+ writer.uint32(80).int32(changelogTask_TypeToNumber(message.type));
+ }
return writer;
},
@@ -347,6 +434,13 @@ export const ChangelogTask: MessageFns<ChangelogTask> = {
message.version = reader.string();
continue;
+ case 10:
+ if (tag !== 80) {
+ break;
+ }
+
+ message.type = changelogTask_TypeFromJSON(reader.int32());
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -369,6 +463,7 @@ export const ChangelogTask: MessageFns<ChangelogTask> = {
syncHistoryId: isSet(object.syncHistoryId) ? Long.fromValue(object.syncHistoryId) : Long.ZERO,
sheet: isSet(object.sheet) ? globalThis.String(object.sheet) : "",
version: isSet(object.version) ? globalThis.String(object.version) : "",
+ type: isSet(object.type) ? changelogTask_TypeFromJSON(object.type) : ChangelogTask_Type.TYPE_UNSPECIFIED,
};
},
@@ -401,6 +496,9 @@ export const ChangelogTask: MessageFns<ChangelogTask> = {
if (message.version !== "") {
obj.version = message.version;
}
+ if (message.type !== ChangelogTask_Type.TYPE_UNSPECIFIED) {
+ obj.type = changelogTask_TypeToJSON(message.type);
+ }
return obj;
},
@@ -426,6 +524,7 @@ export const ChangelogTask: MessageFns<ChangelogTask> = {
: Long.ZERO;
message.sheet = object.sheet ?? "";
message.version = object.version ?? "";
+ message.type = object.type ?? ChangelogTask_Type.TYPE_UNSPECIFIED;
return message;
},
};
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 5487848852..af4da12e89 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -110,6 +110,7 @@
- [ChangelogRevision.Op](#bytebase-store-ChangelogRevision-Op)
- [ChangelogTask.Status](#bytebase-store-ChangelogTask-Status)
+ - [ChangelogTask.Type](#bytebase-store-ChangelogTask-Type)
- [store/data_source.proto](#store_data_source-proto)
- [DataSourceExternalSecret](#bytebase-store-DataSourceExternalSecret)
@@ -1901,15 +1902,16 @@ PostgreSQL: RANGE, LIST, HASH (https://www.postgresql.org/docs/current/ddl-parti
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| task_run | [string](#string) | | |
-| issue | [string](#string) | | |
-| revision | [int64](#int64) | | optional |
+| task_run | [string](#string) | | Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} |
+| issue | [string](#string) | | Format: projects/{project}/issues/{issue} |
+| revision | [int64](#int64) | | The revision uid. optional |
| changed_resources | [ChangedResources](#bytebase-store-ChangedResources) | | |
| status | [ChangelogTask.Status](#bytebase-store-ChangelogTask-Status) | | |
| prev_sync_history_id | [int64](#int64) | | |
| sync_history_id | [int64](#int64) | | |
| sheet | [string](#string) | | The sheet that holds the content. Format: projects/{project}/sheets/{sheet} |
| version | [string](#string) | | |
+| type | [ChangelogTask.Type](#bytebase-store-ChangelogTask-Type) | | |
@@ -1944,6 +1946,22 @@ PostgreSQL: RANGE, LIST, HASH (https://www.postgresql.org/docs/current/ddl-parti
| FAILED | 3 | |
+
+<a name="bytebase-store-ChangelogTask-Type"></a>
+
+### ChangelogTask.Type
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| BASELINE | 1 | |
+| MIGRATE | 2 | |
+| MIGRATE_SDL | 3 | |
+| MIGRATE_GHOST | 4 | |
+| DATA | 6 | |
+
+
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index deaf4863a1..cb48231983 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -606,6 +606,10 @@
<a href="#bytebase.store.ChangelogTask.Status"><span class="badge">E</span>ChangelogTask.Status</a>
</li>
+ <li>
+ <a href="#bytebase.store.ChangelogTask.Type"><span class="badge">E</span>ChangelogTask.Type</a>
+ </li>
+
</ul>
@@ -5311,21 +5315,22 @@ Example: projects/project-id/branches/branch-id. </p></td>
<td>task_run</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun} </p></td>
</tr>
<tr>
<td>issue</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>Format: projects/{project}/issues/{issue} </p></td>
</tr>
<tr>
<td>revision</td>
<td><a href="#int64">int64</a></td>
<td></td>
- <td><p>optional </p></td>
+ <td><p>The revision uid.
+optional </p></td>
</tr>
<tr>
@@ -5371,6 +5376,13 @@ Format: projects/{project}/sheets/{sheet} </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>type</td>
+ <td><a href="#bytebase.store.ChangelogTask.Type">ChangelogTask.Type</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
</tbody>
</table>
@@ -5444,6 +5456,53 @@ Format: projects/{project}/sheets/{sheet} </p></td>
</tbody>
</table>
+ <h3 id="bytebase.store.ChangelogTask.Type">ChangelogTask.Type</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>BASELINE</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE_SDL</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>MIGRATE_GHOST</td>
+ <td>4</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DATA</td>
+ <td>6</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
diff --git a/proto/generated-go/store/changelog.pb.go b/proto/generated-go/store/changelog.pb.go
index 92e7b1ef79..8c5ebe230f 100644
--- a/proto/generated-go/store/changelog.pb.go
+++ b/proto/generated-go/store/changelog.pb.go
@@ -72,6 +72,64 @@ func (ChangelogTask_Status) EnumDescriptor() ([]byte, []int) {
return file_store_changelog_proto_rawDescGZIP(), []int{1, 0}
}
+type ChangelogTask_Type int32
+
+const (
+ ChangelogTask_TYPE_UNSPECIFIED ChangelogTask_Type = 0
+ ChangelogTask_BASELINE ChangelogTask_Type = 1
+ ChangelogTask_MIGRATE ChangelogTask_Type = 2
+ ChangelogTask_MIGRATE_SDL ChangelogTask_Type = 3
+ ChangelogTask_MIGRATE_GHOST ChangelogTask_Type = 4
+ ChangelogTask_DATA ChangelogTask_Type = 6
+)
+
+// Enum value maps for ChangelogTask_Type.
+var (
+ ChangelogTask_Type_name = map[int32]string{
+ 0: "TYPE_UNSPECIFIED",
+ 1: "BASELINE",
+ 2: "MIGRATE",
+ 3: "MIGRATE_SDL",
+ 4: "MIGRATE_GHOST",
+ 6: "DATA",
+ }
+ ChangelogTask_Type_value = map[string]int32{
+ "TYPE_UNSPECIFIED": 0,
+ "BASELINE": 1,
+ "MIGRATE": 2,
+ "MIGRATE_SDL": 3,
+ "MIGRATE_GHOST": 4,
+ "DATA": 6,
+ }
+)
+
+func (x ChangelogTask_Type) Enum() *ChangelogTask_Type {
+ p := new(ChangelogTask_Type)
+ *p = x
+ return p
+}
+
+func (x ChangelogTask_Type) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (ChangelogTask_Type) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_changelog_proto_enumTypes[1].Descriptor()
+}
+
+func (ChangelogTask_Type) Type() protoreflect.EnumType {
+ return &file_store_changelog_proto_enumTypes[1]
+}
+
+func (x ChangelogTask_Type) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use ChangelogTask_Type.Descriptor instead.
+func (ChangelogTask_Type) EnumDescriptor() ([]byte, []int) {
+ return file_store_changelog_proto_rawDescGZIP(), []int{1, 1}
+}
+
type ChangelogRevision_Op int32
const (
@@ -105,11 +163,11 @@ func (x ChangelogRevision_Op) String() string {
}
func (ChangelogRevision_Op) Descriptor() protoreflect.EnumDescriptor {
- return file_store_changelog_proto_enumTypes[1].Descriptor()
+ return file_store_changelog_proto_enumTypes[2].Descriptor()
}
func (ChangelogRevision_Op) Type() protoreflect.EnumType {
- return &file_store_changelog_proto_enumTypes[1]
+ return &file_store_changelog_proto_enumTypes[2]
}
func (x ChangelogRevision_Op) Number() protoreflect.EnumNumber {
@@ -179,8 +237,11 @@ type ChangelogTask struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
+ // Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun}
TaskRun string `protobuf:"bytes,1,opt,name=task_run,json=taskRun,proto3" json:"task_run,omitempty"`
- Issue string `protobuf:"bytes,2,opt,name=issue,proto3" json:"issue,omitempty"`
+ // Format: projects/{project}/issues/{issue}
+ Issue string `protobuf:"bytes,2,opt,name=issue,proto3" json:"issue,omitempty"`
+ // The revision uid.
// optional
Revision int64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"`
ChangedResources *ChangedResources `protobuf:"bytes,4,opt,name=changed_resources,json=changedResources,proto3" json:"changed_resources,omitempty"`
@@ -189,8 +250,9 @@ type ChangelogTask struct {
SyncHistoryId int64 `protobuf:"varint,7,opt,name=sync_history_id,json=syncHistoryId,proto3" json:"sync_history_id,omitempty"`
// The sheet that holds the content.
// Format: projects/{project}/sheets/{sheet}
- Sheet string `protobuf:"bytes,8,opt,name=sheet,proto3" json:"sheet,omitempty"`
- Version string `protobuf:"bytes,9,opt,name=version,proto3" json:"version,omitempty"`
+ Sheet string `protobuf:"bytes,8,opt,name=sheet,proto3" json:"sheet,omitempty"`
+ Version string `protobuf:"bytes,9,opt,name=version,proto3" json:"version,omitempty"`
+ Type ChangelogTask_Type `protobuf:"varint,10,opt,name=type,proto3,enum=bytebase.store.ChangelogTask_Type" json:"type,omitempty"`
}
func (x *ChangelogTask) Reset() {
@@ -286,6 +348,13 @@ func (x *ChangelogTask) GetVersion() string {
return ""
}
+func (x *ChangelogTask) GetType() ChangelogTask_Type {
+ if x != nil {
+ return x.Type
+ }
+ return ChangelogTask_TYPE_UNSPECIFIED
+}
+
type ChangelogRevision struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -356,7 +425,7 @@ var file_store_changelog_proto_rawDesc = []byte{
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f,
0x67, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
- 0x69, 0x6f, 0x6e, 0x22, 0xb7, 0x03, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f,
+ 0x69, 0x6f, 0x6e, 0x22, 0xd6, 0x04, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f,
0x67, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x72, 0x75,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x75, 0x6e,
0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x73, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
@@ -379,24 +448,34 @@ var file_store_changelog_proto_rawDesc = []byte{
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x65,
0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x12, 0x18,
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
- 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x43, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53,
- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45,
- 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x4f, 0x4e, 0x45, 0x10,
- 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0xa5, 0x01,
- 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x76, 0x69, 0x73,
- 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12,
- 0x42, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,
- 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x76,
- 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x70, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x22, 0x30, 0x0a, 0x02, 0x4f, 0x70, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x5f,
- 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a,
- 0x06, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c,
- 0x45, 0x54, 0x45, 0x10, 0x02, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
- 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x33,
+ 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f,
+ 0x67, 0x54, 0x61, 0x73, 0x6b, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x22, 0x43, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54,
+ 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12,
+ 0x08, 0x0a, 0x04, 0x44, 0x4f, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49,
+ 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0x65, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
+ 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
+ 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x53, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x10,
+ 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0f,
+ 0x0a, 0x0b, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x44, 0x4c, 0x10, 0x03, 0x12,
+ 0x11, 0x0a, 0x0d, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x5f, 0x47, 0x48, 0x4f, 0x53, 0x54,
+ 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x06, 0x22, 0xa5, 0x01, 0x0a,
+ 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69,
+ 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42,
+ 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,
+ 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x76, 0x69,
+ 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x70, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x22, 0x30, 0x0a, 0x02, 0x4f, 0x70, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x5f, 0x55,
+ 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06,
+ 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45,
+ 0x54, 0x45, 0x10, 0x02, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
+ 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
}
var (
@@ -411,27 +490,29 @@ func file_store_changelog_proto_rawDescGZIP() []byte {
return file_store_changelog_proto_rawDescData
}
-var file_store_changelog_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_store_changelog_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_store_changelog_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_store_changelog_proto_goTypes = []any{
(ChangelogTask_Status)(0), // 0: bytebase.store.ChangelogTask.Status
- (ChangelogRevision_Op)(0), // 1: bytebase.store.ChangelogRevision.Op
- (*ChangelogPayload)(nil), // 2: bytebase.store.ChangelogPayload
- (*ChangelogTask)(nil), // 3: bytebase.store.ChangelogTask
- (*ChangelogRevision)(nil), // 4: bytebase.store.ChangelogRevision
- (*ChangedResources)(nil), // 5: bytebase.store.ChangedResources
+ (ChangelogTask_Type)(0), // 1: bytebase.store.ChangelogTask.Type
+ (ChangelogRevision_Op)(0), // 2: bytebase.store.ChangelogRevision.Op
+ (*ChangelogPayload)(nil), // 3: bytebase.store.ChangelogPayload
+ (*ChangelogTask)(nil), // 4: bytebase.store.ChangelogTask
+ (*ChangelogRevision)(nil), // 5: bytebase.store.ChangelogRevision
+ (*ChangedResources)(nil), // 6: bytebase.store.ChangedResources
}
var file_store_changelog_proto_depIdxs = []int32{
- 3, // 0: bytebase.store.ChangelogPayload.task:type_name -> bytebase.store.ChangelogTask
- 4, // 1: bytebase.store.ChangelogPayload.revision:type_name -> bytebase.store.ChangelogRevision
- 5, // 2: bytebase.store.ChangelogTask.changed_resources:type_name -> bytebase.store.ChangedResources
+ 4, // 0: bytebase.store.ChangelogPayload.task:type_name -> bytebase.store.ChangelogTask
+ 5, // 1: bytebase.store.ChangelogPayload.revision:type_name -> bytebase.store.ChangelogRevision
+ 6, // 2: bytebase.store.ChangelogTask.changed_resources:type_name -> bytebase.store.ChangedResources
0, // 3: bytebase.store.ChangelogTask.status:type_name -> bytebase.store.ChangelogTask.Status
- 1, // 4: bytebase.store.ChangelogRevision.operation:type_name -> bytebase.store.ChangelogRevision.Op
- 5, // [5:5] is the sub-list for method output_type
- 5, // [5:5] is the sub-list for method input_type
- 5, // [5:5] is the sub-list for extension type_name
- 5, // [5:5] is the sub-list for extension extendee
- 0, // [0:5] is the sub-list for field type_name
+ 1, // 4: bytebase.store.ChangelogTask.type:type_name -> bytebase.store.ChangelogTask.Type
+ 2, // 5: bytebase.store.ChangelogRevision.operation:type_name -> bytebase.store.ChangelogRevision.Op
+ 6, // [6:6] is the sub-list for method output_type
+ 6, // [6:6] is the sub-list for method input_type
+ 6, // [6:6] is the sub-list for extension type_name
+ 6, // [6:6] is the sub-list for extension extendee
+ 0, // [0:6] is the sub-list for field type_name
}
func init() { file_store_changelog_proto_init() }
@@ -445,7 +526,7 @@ func file_store_changelog_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_store_changelog_proto_rawDesc,
- NumEnums: 2,
+ NumEnums: 3,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
diff --git a/proto/store/changelog.proto b/proto/store/changelog.proto
index df990b6c8d..ce5574456d 100644
--- a/proto/store/changelog.proto
+++ b/proto/store/changelog.proto
@@ -12,9 +12,12 @@ message ChangelogPayload {
}
message ChangelogTask {
+ // Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskruns/{taskrun}
string task_run = 1;
+ // Format: projects/{project}/issues/{issue}
string issue = 2;
+ // The revision uid.
// optional
int64 revision = 3;
@@ -37,6 +40,16 @@ message ChangelogTask {
string sheet = 8;
string version = 9;
+
+ enum Type {
+ TYPE_UNSPECIFIED = 0;
+ BASELINE = 1;
+ MIGRATE = 2;
+ MIGRATE_SDL = 3;
+ MIGRATE_GHOST = 4;
+ DATA = 6;
+ }
+ Type type = 10;
}
message ChangelogRevision {