Skip to content

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

feat: revision type (#17082)

p0ny170637333c7a
diff --git a/backend/api/v1/revision_service.go b/backend/api/v1/revision_service.go
index 1c78ecfe9b..45e0185cdc 100644
--- a/backend/api/v1/revision_service.go
+++ b/backend/api/v1/revision_service.go
@@ -311,6 +311,7 @@ func convertToRevision(ctx context.Context, s *store.Store, parent string, revis
File: revision.Payload.File,
Issue: issueName,
TaskRun: taskRunName,
+ Type: convertToRevisionType(revision.Payload.Type),
}
if revision.DeleterUID != nil {
@@ -330,6 +331,20 @@ func convertToRevision(ctx context.Context, s *store.Store, parent string, revis
return r, nil
}
+func convertToRevisionType(t storepb.RevisionPayload_Type) v1pb.Revision_Type {
+ //exhaustive:enforce
+ switch t {
+ case storepb.RevisionPayload_TYPE_UNSPECIFIED:
+ return v1pb.Revision_TYPE_UNSPECIFIED
+ case storepb.RevisionPayload_VERSIONED:
+ return v1pb.Revision_VERSIONED
+ case storepb.RevisionPayload_DECLARATIVE:
+ return v1pb.Revision_DECLARATIVE
+ default:
+ return v1pb.Revision_TYPE_UNSPECIFIED
+ }
+}
+
func convertRevision(revision *v1pb.Revision, database *store.DatabaseMessage, sheet *store.SheetMessage) *store.RevisionMessage {
r := &store.RevisionMessage{
InstanceID: database.InstanceID,
@@ -341,7 +356,22 @@ func convertRevision(revision *v1pb.Revision, database *store.DatabaseMessage, s
Sheet: revision.Sheet,
SheetSha256: sheet.GetSha256Hex(),
TaskRun: revision.TaskRun,
+ Type: convertRevisionType(revision.Type),
},
}
return r
}
+
+func convertRevisionType(t v1pb.Revision_Type) storepb.RevisionPayload_Type {
+ //exhaustive:enforce
+ switch t {
+ case v1pb.Revision_TYPE_UNSPECIFIED:
+ return storepb.RevisionPayload_TYPE_UNSPECIFIED
+ case v1pb.Revision_VERSIONED:
+ return storepb.RevisionPayload_VERSIONED
+ case v1pb.Revision_DECLARATIVE:
+ return storepb.RevisionPayload_DECLARATIVE
+ default:
+ return storepb.RevisionPayload_TYPE_UNSPECIFIED
+ }
+}
diff --git a/backend/generated-go/store/revision.pb.go b/backend/generated-go/store/revision.pb.go
index 4833188d12..65f5f39beb 100644
--- a/backend/generated-go/store/revision.pb.go
+++ b/backend/generated-go/store/revision.pb.go
@@ -22,6 +22,55 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
+type RevisionPayload_Type int32
+
+const (
+ RevisionPayload_TYPE_UNSPECIFIED RevisionPayload_Type = 0
+ RevisionPayload_VERSIONED RevisionPayload_Type = 1
+ RevisionPayload_DECLARATIVE RevisionPayload_Type = 2
+)
+
+// Enum value maps for RevisionPayload_Type.
+var (
+ RevisionPayload_Type_name = map[int32]string{
+ 0: "TYPE_UNSPECIFIED",
+ 1: "VERSIONED",
+ 2: "DECLARATIVE",
+ }
+ RevisionPayload_Type_value = map[string]int32{
+ "TYPE_UNSPECIFIED": 0,
+ "VERSIONED": 1,
+ "DECLARATIVE": 2,
+ }
+)
+
+func (x RevisionPayload_Type) Enum() *RevisionPayload_Type {
+ p := new(RevisionPayload_Type)
+ *p = x
+ return p
+}
+
+func (x RevisionPayload_Type) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (RevisionPayload_Type) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_revision_proto_enumTypes[0].Descriptor()
+}
+
+func (RevisionPayload_Type) Type() protoreflect.EnumType {
+ return &file_store_revision_proto_enumTypes[0]
+}
+
+func (x RevisionPayload_Type) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use RevisionPayload_Type.Descriptor instead.
+func (RevisionPayload_Type) EnumDescriptor() ([]byte, []int) {
+ return file_store_revision_proto_rawDescGZIP(), []int{0, 0}
+}
+
type RevisionPayload struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Format: projects/{project}/releases/{release}
@@ -38,7 +87,9 @@ type RevisionPayload struct {
// The task run associated with the revision.
// Can be empty.
// Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun}
- TaskRun string `protobuf:"bytes,5,opt,name=task_run,json=taskRun,proto3" json:"task_run,omitempty"`
+ TaskRun string `protobuf:"bytes,5,opt,name=task_run,json=taskRun,proto3" json:"task_run,omitempty"`
+ // The type of the revision.
+ Type RevisionPayload_Type `protobuf:"varint,6,opt,name=type,proto3,enum=bytebase.store.RevisionPayload_Type" json:"type,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -108,11 +159,18 @@ func (x *RevisionPayload) GetTaskRun() string {
return ""
}
+func (x *RevisionPayload) GetType() RevisionPayload_Type {
+ if x != nil {
+ return x.Type
+ }
+ return RevisionPayload_TYPE_UNSPECIFIED
+}
+
var File_store_revision_proto protoreflect.FileDescriptor
const file_store_revision_proto_rawDesc = "" +
"\n" +
- "\x14store/revision.proto\x12\x0ebytebase.store\x1a\x19google/api/resource.proto\"\xe2\x01\n" +
+ "\x14store/revision.proto\x12\x0ebytebase.store\x1a\x19google/api/resource.proto\"\xda\x02\n" +
"\x0fRevisionPayload\x123\n" +
"\arelease\x18\x01 \x01(\tB\x19\xfaA\x16\n" +
"\x14bytebase.com/ReleaseR\arelease\x12\x12\n" +
@@ -121,7 +179,12 @@ const file_store_revision_proto_rawDesc = "" +
"\x12bytebase.com/SheetR\x05sheet\x12!\n" +
"\fsheet_sha256\x18\x04 \x01(\tR\vsheetSha256\x124\n" +
"\btask_run\x18\x05 \x01(\tB\x19\xfaA\x16\n" +
- "\x14bytebase.com/TaskRunR\ataskRunB\x14Z\x12generated-go/storeb\x06proto3"
+ "\x14bytebase.com/TaskRunR\ataskRun\x128\n" +
+ "\x04type\x18\x06 \x01(\x0e2$.bytebase.store.RevisionPayload.TypeR\x04type\"<\n" +
+ "\x04Type\x12\x14\n" +
+ "\x10TYPE_UNSPECIFIED\x10\x00\x12\r\n" +
+ "\tVERSIONED\x10\x01\x12\x0f\n" +
+ "\vDECLARATIVE\x10\x02B\x14Z\x12generated-go/storeb\x06proto3"
var (
file_store_revision_proto_rawDescOnce sync.Once
@@ -135,16 +198,19 @@ func file_store_revision_proto_rawDescGZIP() []byte {
return file_store_revision_proto_rawDescData
}
+var file_store_revision_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_store_revision_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_store_revision_proto_goTypes = []any{
- (*RevisionPayload)(nil), // 0: bytebase.store.RevisionPayload
+ (RevisionPayload_Type)(0), // 0: bytebase.store.RevisionPayload.Type
+ (*RevisionPayload)(nil), // 1: bytebase.store.RevisionPayload
}
var file_store_revision_proto_depIdxs = []int32{
- 0, // [0:0] is the sub-list for method output_type
- 0, // [0:0] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
+ 0, // 0: bytebase.store.RevisionPayload.type:type_name -> bytebase.store.RevisionPayload.Type
+ 1, // [1:1] is the sub-list for method output_type
+ 1, // [1:1] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
}
func init() { file_store_revision_proto_init() }
@@ -157,13 +223,14 @@ func file_store_revision_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_revision_proto_rawDesc), len(file_store_revision_proto_rawDesc)),
- NumEnums: 0,
+ NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_store_revision_proto_goTypes,
DependencyIndexes: file_store_revision_proto_depIdxs,
+ EnumInfos: file_store_revision_proto_enumTypes,
MessageInfos: file_store_revision_proto_msgTypes,
}.Build()
File_store_revision_proto = out.File
diff --git a/backend/generated-go/v1/revision_service.pb.go b/backend/generated-go/v1/revision_service.pb.go
index d6a7a1384a..1714e4e0a4 100644
--- a/backend/generated-go/v1/revision_service.pb.go
+++ b/backend/generated-go/v1/revision_service.pb.go
@@ -24,6 +24,55 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
+type Revision_Type int32
+
+const (
+ Revision_TYPE_UNSPECIFIED Revision_Type = 0
+ Revision_VERSIONED Revision_Type = 1
+ Revision_DECLARATIVE Revision_Type = 2
+)
+
+// Enum value maps for Revision_Type.
+var (
+ Revision_Type_name = map[int32]string{
+ 0: "TYPE_UNSPECIFIED",
+ 1: "VERSIONED",
+ 2: "DECLARATIVE",
+ }
+ Revision_Type_value = map[string]int32{
+ "TYPE_UNSPECIFIED": 0,
+ "VERSIONED": 1,
+ "DECLARATIVE": 2,
+ }
+)
+
+func (x Revision_Type) Enum() *Revision_Type {
+ p := new(Revision_Type)
+ *p = x
+ return p
+}
+
+func (x Revision_Type) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Revision_Type) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_revision_service_proto_enumTypes[0].Descriptor()
+}
+
+func (Revision_Type) Type() protoreflect.EnumType {
+ return &file_v1_revision_service_proto_enumTypes[0]
+}
+
+func (x Revision_Type) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Revision_Type.Descriptor instead.
+func (Revision_Type) EnumDescriptor() ([]byte, []int) {
+ return file_v1_revision_service_proto_rawDescGZIP(), []int{7, 0}
+}
+
type ListRevisionsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The parent of the revisions.
@@ -436,7 +485,9 @@ type Revision struct {
// Can be empty.
// Format:
// projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun}
- TaskRun string `protobuf:"bytes,14,opt,name=task_run,json=taskRun,proto3" json:"task_run,omitempty"`
+ TaskRun string `protobuf:"bytes,14,opt,name=task_run,json=taskRun,proto3" json:"task_run,omitempty"`
+ // The type of the revision.
+ Type Revision_Type `protobuf:"varint,15,opt,name=type,proto3,enum=bytebase.v1.Revision_Type" json:"type,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -562,6 +613,13 @@ func (x *Revision) GetTaskRun() string {
return ""
}
+func (x *Revision) GetType() Revision_Type {
+ if x != nil {
+ return x.Type
+ }
+ return Revision_TYPE_UNSPECIFIED
+}
+
var File_v1_revision_service_proto protoreflect.FileDescriptor
const file_v1_revision_service_proto_rawDesc = "" +
@@ -592,7 +650,7 @@ const file_v1_revision_service_proto_rawDesc = "" +
"\x15bytebase.com/RevisionR\x04name\"J\n" +
"\x15DeleteRevisionRequest\x121\n" +
"\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" +
- "\x15bytebase.com/RevisionR\x04name\"\x86\x05\n" +
+ "\x15bytebase.com/RevisionR\x04name\"\xf4\x05\n" +
"\bRevision\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x123\n" +
"\arelease\x18\x02 \x01(\tB\x19\xfaA\x16\n" +
@@ -613,7 +671,12 @@ const file_v1_revision_service_proto_rawDesc = "" +
"\x05issue\x18\r \x01(\tB\x17\xfaA\x14\n" +
"\x12bytebase.com/IssueR\x05issue\x124\n" +
"\btask_run\x18\x0e \x01(\tB\x19\xfaA\x16\n" +
- "\x14bytebase.com/TaskRunR\ataskRun:Z\xeaAW\n" +
+ "\x14bytebase.com/TaskRunR\ataskRun\x12.\n" +
+ "\x04type\x18\x0f \x01(\x0e2\x1a.bytebase.v1.Revision.TypeR\x04type\"<\n" +
+ "\x04Type\x12\x14\n" +
+ "\x10TYPE_UNSPECIFIED\x10\x00\x12\r\n" +
+ "\tVERSIONED\x10\x01\x12\x0f\n" +
+ "\vDECLARATIVE\x10\x02:Z\xeaAW\n" +
"\x15bytebase.com/Revision\x12>instances/{instance}/databases/{database}/revisions/{revision}2\x87\a\n" +
"\x0fRevisionService\x12\xb0\x01\n" +
"\rListRevisions\x12!.bytebase.v1.ListRevisionsRequest\x1a\".bytebase.v1.ListRevisionsResponse\"X\xdaA\x06parent\x8a\xea0\x11bb.revisions.list\x90\xea0\x01\x82\xd3\xe4\x93\x020\x12./v1/{parent=instances/*/databases/*}/revisions\x12\x9c\x01\n" +
@@ -634,41 +697,44 @@ func file_v1_revision_service_proto_rawDescGZIP() []byte {
return file_v1_revision_service_proto_rawDescData
}
+var file_v1_revision_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_v1_revision_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_v1_revision_service_proto_goTypes = []any{
- (*ListRevisionsRequest)(nil), // 0: bytebase.v1.ListRevisionsRequest
- (*ListRevisionsResponse)(nil), // 1: bytebase.v1.ListRevisionsResponse
- (*CreateRevisionRequest)(nil), // 2: bytebase.v1.CreateRevisionRequest
- (*BatchCreateRevisionsRequest)(nil), // 3: bytebase.v1.BatchCreateRevisionsRequest
- (*BatchCreateRevisionsResponse)(nil), // 4: bytebase.v1.BatchCreateRevisionsResponse
- (*GetRevisionRequest)(nil), // 5: bytebase.v1.GetRevisionRequest
- (*DeleteRevisionRequest)(nil), // 6: bytebase.v1.DeleteRevisionRequest
- (*Revision)(nil), // 7: bytebase.v1.Revision
- (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
- (*emptypb.Empty)(nil), // 9: google.protobuf.Empty
+ (Revision_Type)(0), // 0: bytebase.v1.Revision.Type
+ (*ListRevisionsRequest)(nil), // 1: bytebase.v1.ListRevisionsRequest
+ (*ListRevisionsResponse)(nil), // 2: bytebase.v1.ListRevisionsResponse
+ (*CreateRevisionRequest)(nil), // 3: bytebase.v1.CreateRevisionRequest
+ (*BatchCreateRevisionsRequest)(nil), // 4: bytebase.v1.BatchCreateRevisionsRequest
+ (*BatchCreateRevisionsResponse)(nil), // 5: bytebase.v1.BatchCreateRevisionsResponse
+ (*GetRevisionRequest)(nil), // 6: bytebase.v1.GetRevisionRequest
+ (*DeleteRevisionRequest)(nil), // 7: bytebase.v1.DeleteRevisionRequest
+ (*Revision)(nil), // 8: bytebase.v1.Revision
+ (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
+ (*emptypb.Empty)(nil), // 10: google.protobuf.Empty
}
var file_v1_revision_service_proto_depIdxs = []int32{
- 7, // 0: bytebase.v1.ListRevisionsResponse.revisions:type_name -> bytebase.v1.Revision
- 7, // 1: bytebase.v1.CreateRevisionRequest.revision:type_name -> bytebase.v1.Revision
- 2, // 2: bytebase.v1.BatchCreateRevisionsRequest.requests:type_name -> bytebase.v1.CreateRevisionRequest
- 7, // 3: bytebase.v1.BatchCreateRevisionsResponse.revisions:type_name -> bytebase.v1.Revision
- 8, // 4: bytebase.v1.Revision.create_time:type_name -> google.protobuf.Timestamp
- 8, // 5: bytebase.v1.Revision.delete_time:type_name -> google.protobuf.Timestamp
- 0, // 6: bytebase.v1.RevisionService.ListRevisions:input_type -> bytebase.v1.ListRevisionsRequest
- 5, // 7: bytebase.v1.RevisionService.GetRevision:input_type -> bytebase.v1.GetRevisionRequest
- 2, // 8: bytebase.v1.RevisionService.CreateRevision:input_type -> bytebase.v1.CreateRevisionRequest
- 3, // 9: bytebase.v1.RevisionService.BatchCreateRevisions:input_type -> bytebase.v1.BatchCreateRevisionsRequest
- 6, // 10: bytebase.v1.RevisionService.DeleteRevision:input_type -> bytebase.v1.DeleteRevisionRequest
- 1, // 11: bytebase.v1.RevisionService.ListRevisions:output_type -> bytebase.v1.ListRevisionsResponse
- 7, // 12: bytebase.v1.RevisionService.GetRevision:output_type -> bytebase.v1.Revision
- 7, // 13: bytebase.v1.RevisionService.CreateRevision:output_type -> bytebase.v1.Revision
- 4, // 14: bytebase.v1.RevisionService.BatchCreateRevisions:output_type -> bytebase.v1.BatchCreateRevisionsResponse
- 9, // 15: bytebase.v1.RevisionService.DeleteRevision:output_type -> google.protobuf.Empty
- 11, // [11:16] is the sub-list for method output_type
- 6, // [6:11] 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
+ 8, // 0: bytebase.v1.ListRevisionsResponse.revisions:type_name -> bytebase.v1.Revision
+ 8, // 1: bytebase.v1.CreateRevisionRequest.revision:type_name -> bytebase.v1.Revision
+ 3, // 2: bytebase.v1.BatchCreateRevisionsRequest.requests:type_name -> bytebase.v1.CreateRevisionRequest
+ 8, // 3: bytebase.v1.BatchCreateRevisionsResponse.revisions:type_name -> bytebase.v1.Revision
+ 9, // 4: bytebase.v1.Revision.create_time:type_name -> google.protobuf.Timestamp
+ 9, // 5: bytebase.v1.Revision.delete_time:type_name -> google.protobuf.Timestamp
+ 0, // 6: bytebase.v1.Revision.type:type_name -> bytebase.v1.Revision.Type
+ 1, // 7: bytebase.v1.RevisionService.ListRevisions:input_type -> bytebase.v1.ListRevisionsRequest
+ 6, // 8: bytebase.v1.RevisionService.GetRevision:input_type -> bytebase.v1.GetRevisionRequest
+ 3, // 9: bytebase.v1.RevisionService.CreateRevision:input_type -> bytebase.v1.CreateRevisionRequest
+ 4, // 10: bytebase.v1.RevisionService.BatchCreateRevisions:input_type -> bytebase.v1.BatchCreateRevisionsRequest
+ 7, // 11: bytebase.v1.RevisionService.DeleteRevision:input_type -> bytebase.v1.DeleteRevisionRequest
+ 2, // 12: bytebase.v1.RevisionService.ListRevisions:output_type -> bytebase.v1.ListRevisionsResponse
+ 8, // 13: bytebase.v1.RevisionService.GetRevision:output_type -> bytebase.v1.Revision
+ 8, // 14: bytebase.v1.RevisionService.CreateRevision:output_type -> bytebase.v1.Revision
+ 5, // 15: bytebase.v1.RevisionService.BatchCreateRevisions:output_type -> bytebase.v1.BatchCreateRevisionsResponse
+ 10, // 16: bytebase.v1.RevisionService.DeleteRevision:output_type -> google.protobuf.Empty
+ 12, // [12:17] is the sub-list for method output_type
+ 7, // [7:12] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_v1_revision_service_proto_init() }
@@ -682,13 +748,14 @@ func file_v1_revision_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_revision_service_proto_rawDesc), len(file_v1_revision_service_proto_rawDesc)),
- NumEnums: 0,
+ NumEnums: 1,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v1_revision_service_proto_goTypes,
DependencyIndexes: file_v1_revision_service_proto_depIdxs,
+ EnumInfos: file_v1_revision_service_proto_enumTypes,
MessageInfos: file_v1_revision_service_proto_msgTypes,
}.Build()
File_v1_revision_service_proto = out.File
diff --git a/backend/migrator/migration/3.9/0007##revision_type_backfill.sql b/backend/migrator/migration/3.9/0007##revision_type_backfill.sql
new file mode 100644
index 0000000000..76ac0c543a
--- /dev/null
+++ b/backend/migrator/migration/3.9/0007##revision_type_backfill.sql
@@ -0,0 +1 @@
+UPDATE revision SET payload = payload || '{"type": "VERSIONED"}';
\ No newline at end of file
diff --git a/backend/migrator/migration/3.9/0008##revision_index.sql b/backend/migrator/migration/3.9/0008##revision_index.sql
new file mode 100644
index 0000000000..6aecd83162
--- /dev/null
+++ b/backend/migrator/migration/3.9/0008##revision_index.sql
@@ -0,0 +1,5 @@
+DROP INDEX IF EXISTS idx_revision_unique_instance_db_name_version_deleted_at_null;
+DROP INDEX IF EXISTS idx_revision_instance_db_name_version;
+
+CREATE UNIQUE INDEX idx_revision_unique_instance_db_name_type_version_deleted_at_null ON revision(instance, db_name, (payload->>'type'), version) WHERE deleted_at IS NULL;
+CREATE INDEX idx_revision_instance_db_name_type_version ON revision(instance, db_name, (payload->>'type'), version);
\ No newline at end of file
diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sql
index 5be2746c9a..8acbe3bae6 100644
--- a/backend/migrator/migration/LATEST.sql
+++ b/backend/migrator/migration/LATEST.sql
@@ -467,9 +467,9 @@ CREATE TABLE revision (
ALTER SEQUENCE revision_id_seq RESTART WITH 101;
-CREATE UNIQUE INDEX idx_revision_unique_instance_db_name_version_deleted_at_null ON revision(instance, db_name, version) WHERE deleted_at IS NULL;
+CREATE UNIQUE INDEX idx_revision_unique_instance_db_name_version_deleted_at_null ON revision(instance, db_name, (payload->>'type'), version) WHERE deleted_at IS NULL;
-CREATE INDEX idx_revision_instance_db_name_version ON revision(instance, db_name, version);
+CREATE INDEX idx_revision_instance_db_name_version ON revision(instance, db_name, (payload->>'type'), version);
CREATE TABLE sync_history (
id bigserial PRIMARY KEY,
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 59391aed53..499acbf47a 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.9.6"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.9.8"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/store/revision.go b/backend/store/revision.go
index 683867a305..ba47671ba3 100644
--- a/backend/store/revision.go
+++ b/backend/store/revision.go
@@ -155,6 +155,7 @@ func (s *Store) GetRevision(ctx context.Context, uid int64) (*RevisionMessage, e
return revisions[0], nil
}
+// TODO(p0ny): make sure revision.type is set
func (s *Store) CreateRevision(ctx context.Context, revision *RevisionMessage) (*RevisionMessage, error) {
query := `
INSERT INTO revision (
diff --git a/frontend/src/types/proto-es/v1/revision_service_pb.d.ts b/frontend/src/types/proto-es/v1/revision_service_pb.d.ts
index 6a96ab9c4e..4dfcf5a900 100644
--- a/frontend/src/types/proto-es/v1/revision_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/revision_service_pb.d.ts
@@ -2,7 +2,7 @@
// @generated from file v1/revision_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
+import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
import type { EmptySchema, Timestamp } from "@bufbuild/protobuf/wkt";
@@ -284,6 +284,13 @@ export declare type Revision = Message<"bytebase.v1.Revision"> & {
* @generated from field: string task_run = 14;
*/
taskRun: string;
+
+ /**
+ * The type of the revision.
+ *
+ * @generated from field: bytebase.v1.Revision.Type type = 15;
+ */
+ type: Revision_Type;
};
/**
@@ -292,6 +299,31 @@ export declare type Revision = Message<"bytebase.v1.Revision"> & {
*/
export declare const RevisionSchema: GenMessage<Revision>;
+/**
+ * @generated from enum bytebase.v1.Revision.Type
+ */
+export enum Revision_Type {
+ /**
+ * @generated from enum value: TYPE_UNSPECIFIED = 0;
+ */
+ TYPE_UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: VERSIONED = 1;
+ */
+ VERSIONED = 1,
+
+ /**
+ * @generated from enum value: DECLARATIVE = 2;
+ */
+ DECLARATIVE = 2,
+}
+
+/**
+ * Describes the enum bytebase.v1.Revision.Type.
+ */
+export declare const Revision_TypeSchema: GenEnum<Revision_Type>;
+
/**
* @generated from service bytebase.v1.RevisionService
*/
diff --git a/frontend/src/types/proto-es/v1/revision_service_pb.js b/frontend/src/types/proto-es/v1/revision_service_pb.js
index 9c9b2ae15e..e30b1bfa09 100644
--- a/frontend/src/types/proto-es/v1/revision_service_pb.js
+++ b/frontend/src/types/proto-es/v1/revision_service_pb.js
@@ -2,7 +2,7 @@
// @generated from file v1/revision_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
+import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
@@ -14,7 +14,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/revision_service.proto.
*/
export const file_v1_revision_service = /*@__PURE__*/
- fileDesc("Chl2MS9yZXZpc2lvbl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSKCAQoUTGlzdFJldmlzaW9uc1JlcXVlc3QSLQoGcGFyZW50GAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIUCgxzaG93X2RlbGV0ZWQYBCABKAgiWgoVTGlzdFJldmlzaW9uc1Jlc3BvbnNlEigKCXJldmlzaW9ucxgBIAMoCzIVLmJ5dGViYXNlLnYxLlJldmlzaW9uEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJ0ChVDcmVhdGVSZXZpc2lvblJlcXVlc3QSLQoGcGFyZW50GAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIsCghyZXZpc2lvbhgCIAEoCzIVLmJ5dGViYXNlLnYxLlJldmlzaW9uQgPgQQIihwEKG0JhdGNoQ3JlYXRlUmV2aXNpb25zUmVxdWVzdBItCgZwYXJlbnQYASABKAlCHeBBAvpBFwoVYnl0ZWJhc2UuY29tL0RhdGFiYXNlEjkKCHJlcXVlc3RzGAIgAygLMiIuYnl0ZWJhc2UudjEuQ3JlYXRlUmV2aXNpb25SZXF1ZXN0QgPgQQIiSAocQmF0Y2hDcmVhdGVSZXZpc2lvbnNSZXNwb25zZRIoCglyZXZpc2lvbnMYASADKAsyFS5ieXRlYmFzZS52MS5SZXZpc2lvbiJBChJHZXRSZXZpc2lvblJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vUmV2aXNpb24iRAoVRGVsZXRlUmV2aXNpb25SZXF1ZXN0EisKBG5hbWUYASABKAlCHeBBAvpBFwoVYnl0ZWJhc2UuY29tL1JldmlzaW9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QQRuYW1liuowEGJiLnJldmlzaW9ucy5nZXSQ6jABgtPkkwIwEi4vdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyovcmV2aXNpb25zLyp9EqgBCg5DcmVhdGVSZXZpc2lvbhIiLmJ5dGViYXNlLnYxLkNyZWF0ZVJldmlzaW9uUmVxdWVzdBoVLmJ5dGViYXNlLnYxLlJldmlzaW9uIluK6jATYmIucmV2aXNpb25zLmNyZWF0ZZDqMAGC0+STAjo6CHJldmlzaW9uIi4vdjEve3BhcmVudD1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKn0vcmV2aXNpb25zEs0BChRCYXRjaENyZWF0ZVJldmlzaW9ucxIoLmJ5dGViYXNlLnYxLkJhdGNoQ3JlYXRlUmV2aXNpb25zUmVxdWVzdBopLmJ5dGViYXNlLnYxLkJhdGNoQ3JlYXRlUmV2aXNpb25zUmVzcG9uc2UiYIrqMBNiYi5yZXZpc2lvbnMuY3JlYXRlkOowAYLT5JMCPzoBKiI6L3YxL3twYXJlbnQ9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyp9L3JldmlzaW9uczpiYXRjaENyZWF0ZRKmAQoORGVsZXRlUmV2aXNpb24SIi5ieXRlYmFzZS52MS5EZWxldGVSZXZpc2lvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiWNpBBG5hbWWK6jATYmIucmV2aXNpb25zLmRlbGV0ZZDqMAGC0+STAjAqLi92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKi9yZXZpc2lvbnMvKn1CNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation]);
+ fileDesc("Chl2MS9yZXZpc2lvbl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS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YmIucmV2aXNpb25zLmdldJDqMAGC0+STAjASLi92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKi9yZXZpc2lvbnMvKn0SqAEKDkNyZWF0ZVJldmlzaW9uEiIuYnl0ZWJhc2UudjEuQ3JlYXRlUmV2aXNpb25SZXF1ZXN0GhUuYnl0ZWJhc2UudjEuUmV2aXNpb24iW4rqMBNiYi5yZXZpc2lvbnMuY3JlYXRlkOowAYLT5JMCOjoIcmV2aXNpb24iLi92MS97cGFyZW50PWluc3RhbmNlcy8qL2RhdGFiYXNlcy8qfS9yZXZpc2lvbnMSzQEKFEJhdGNoQ3JlYXRlUmV2aXNpb25zEiguYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVSZXZpc2lvbnNSZXF1ZXN0GikuYnl0ZWJhc2UudjEuQmF0Y2hDcmVhdGVSZXZpc2lvbnNSZXNwb25zZSJgiuowE2JiLnJldmlzaW9ucy5jcmVhdGWQ6jABgtPkkwI/OgEqIjovdjEve3BhcmVudD1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKn0vcmV2aXNpb25zOmJhdGNoQ3JlYXRlEqYBCg5EZWxldGVSZXZpc2lvbhIiLmJ5dGViYXNlLnYxLkRlbGV0ZVJldmlzaW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSJY2kEEbmFtZYrqMBNiYi5yZXZpc2lvbnMuZGVsZXRlkOowAYLT5JMCMCouL3YxL3tuYW1lPWluc3RhbmNlcy8qL2RhdGFiYXNlcy8qL3JldmlzaW9ucy8qfUI2WjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation]);
/**
* Describes the message bytebase.v1.ListRevisionsRequest.
@@ -72,6 +72,18 @@ export const DeleteRevisionRequestSchema = /*@__PURE__*/
export const RevisionSchema = /*@__PURE__*/
messageDesc(file_v1_revision_service, 7);
+/**
+ * Describes the enum bytebase.v1.Revision.Type.
+ */
+export const Revision_TypeSchema = /*@__PURE__*/
+ enumDesc(file_v1_revision_service, 7, 0);
+
+/**
+ * @generated from enum bytebase.v1.Revision.Type
+ */
+export const Revision_Type = /*@__PURE__*/
+ tsEnum(Revision_TypeSchema);
+
/**
* @generated from service bytebase.v1.RevisionService
*/
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 2a1798a4ed..7c9cd556af 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -12481,6 +12481,14 @@ components:
Can be empty.
Format:
projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun}
+ type:
+ enum:
+ - TYPE_UNSPECIFIED
+ - VERSIONED
+ - DECLARATIVE
+ type: string
+ description: The type of the revision.
+ format: enum
Risk:
type: object
properties:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 32c8afec42..c43436d8b2 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -250,6 +250,8 @@
- [store/revision.proto](#store_revision-proto)
- [RevisionPayload](#bytebase-store-RevisionPayload)
+ - [RevisionPayload.Type](#bytebase-store-RevisionPayload-Type)
+
- [store/role.proto](#store_role-proto)
- [RolePermissions](#bytebase-store-RolePermissions)
@@ -3994,6 +3996,7 @@ RestrictIssueCreationForSQLReviewPolicy is the policy configuration for restrict
| sheet | [string](#string) | | The sheet that holds the content. Format: projects/{project}/sheets/{sheet} |
| sheet_sha256 | [string](#string) | | The SHA256 hash value of the sheet. |
| task_run | [string](#string) | | The task run associated with the revision. Can be empty. Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun} |
+| type | [RevisionPayload.Type](#bytebase-store-RevisionPayload-Type) | | The type of the revision. |
@@ -4001,6 +4004,19 @@ RestrictIssueCreationForSQLReviewPolicy is the policy configuration for restrict
+
+<a name="bytebase-store-RevisionPayload-Type"></a>
+
+### RevisionPayload.Type
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| VERSIONED | 1 | |
+| DECLARATIVE | 2 | |
+
+
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 9f462ddfb2..98c5ab6c8a 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -1175,6 +1175,10 @@
</li>
+ <li>
+ <a href="#bytebase.store.RevisionPayload.Type"><span class="badge">E</span>RevisionPayload.Type</a>
+ </li>
+
</ul>
@@ -10649,6 +10653,13 @@ Can be empty.
Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun} </p></td>
</tr>
+ <tr>
+ <td>type</td>
+ <td><a href="#bytebase.store.RevisionPayload.Type">RevisionPayload.Type</a></td>
+ <td></td>
+ <td><p>The type of the revision. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -10658,6 +10669,35 @@ Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRu
+ <h3 id="bytebase.store.RevisionPayload.Type">RevisionPayload.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>VERSIONED</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DECLARATIVE</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 4f65b938cb..87806d8485 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -575,6 +575,8 @@
- [ListRevisionsResponse](#bytebase-v1-ListRevisionsResponse)
- [Revision](#bytebase-v1-Revision)
+ - [Revision.Type](#bytebase-v1-Revision-Type)
+
- [RevisionService](#bytebase-v1-RevisionService)
- [v1/risk_service.proto](#v1_risk_service-proto)
@@ -9435,6 +9437,7 @@ When paginating, all other parameters provided to `ListRevisions` must match the
| statement_size | [int64](#int64) | | |
| issue | [string](#string) | | The issue associated with the revision. Can be empty. Format: projects/{project}/issues/{issue} |
| task_run | [string](#string) | | The task run associated with the revision. Can be empty. Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun} |
+| type | [Revision.Type](#bytebase-v1-Revision-Type) | | The type of the revision. |
@@ -9442,6 +9445,19 @@ When paginating, all other parameters provided to `ListRevisions` must match the
+
+<a name="bytebase-v1-Revision-Type"></a>
+
+### Revision.Type
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| VERSIONED | 1 | |
+| DECLARATIVE | 2 | |
+
+
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 6e9f1facf6..7858064c3d 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -2375,6 +2375,10 @@
</li>
+ <li>
+ <a href="#bytebase.v1.Revision.Type"><span class="badge">E</span>Revision.Type</a>
+ </li>
+
<li>
@@ -26277,6 +26281,13 @@ Format:
projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun} </p></td>
</tr>
+ <tr>
+ <td>type</td>
+ <td><a href="#bytebase.v1.Revision.Type">Revision.Type</a></td>
+ <td></td>
+ <td><p>The type of the revision. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -26286,6 +26297,35 @@ projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{task
+ <h3 id="bytebase.v1.Revision.Type">Revision.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>VERSIONED</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DECLARATIVE</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
diff --git a/proto/store/store/revision.proto b/proto/store/store/revision.proto
index 368c837d7c..d2258c09a8 100644
--- a/proto/store/store/revision.proto
+++ b/proto/store/store/revision.proto
@@ -25,4 +25,13 @@ message RevisionPayload {
// Can be empty.
// Format: projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun}
string task_run = 5 [(google.api.resource_reference) = {type: "bytebase.com/TaskRun"}];
+
+ // The type of the revision.
+ Type type = 6;
+
+ enum Type {
+ TYPE_UNSPECIFIED = 0;
+ VERSIONED = 1;
+ DECLARATIVE = 2;
+ }
}
diff --git a/proto/v1/v1/revision_service.proto b/proto/v1/v1/revision_service.proto
index e4c88a900a..1dea082ab5 100644
--- a/proto/v1/v1/revision_service.proto
+++ b/proto/v1/v1/revision_service.proto
@@ -183,4 +183,13 @@ message Revision {
// Format:
// projects/{project}/rollouts/{rollout}/stages/{stage}/tasks/{task}/taskRuns/{taskRun}
string task_run = 14 [(google.api.resource_reference) = {type: "bytebase.com/TaskRun"}];
+
+ // The type of the revision.
+ Type type = 15;
+
+ enum Type {
+ TYPE_UNSPECIFIED = 0;
+ VERSIONED = 1;
+ DECLARATIVE = 2;
+ }
}