From 79629a03f94dc276bdb607c34fe5303ab6f7e568 Mon Sep 17 00:00:00 2001 From: Manan Gupta <35839558+GuptaManan100@users.noreply.github.com> Date: Thu, 20 Jul 2023 21:46:03 +0530 Subject: [PATCH] Add a `keyspace` configuration in the `vschema` for foreign key mode (#13553) Signed-off-by: Manan Gupta --- go/vt/proto/vschema/vschema.pb.go | 321 +++++++++++------- go/vt/proto/vschema/vschema_vtproto.pb.go | 27 ++ go/vt/vtgate/vindexes/vschema.go | 42 ++- go/vt/vtgate/vindexes/vschema_test.go | 107 ++++-- go/vt/vtgate/vschema_manager_test.go | 8 +- .../tabletserver/vstreamer/engine_test.go | 1 + proto/vschema.proto | 9 + web/vtadmin/src/proto/vtadmin.d.ts | 17 + web/vtadmin/src/proto/vtadmin.js | 70 ++++ 9 files changed, 443 insertions(+), 159 deletions(-) diff --git a/go/vt/proto/vschema/vschema.pb.go b/go/vt/proto/vschema/vschema.pb.go index 6273229a60e..4783fa51586 100644 --- a/go/vt/proto/vschema/vschema.pb.go +++ b/go/vt/proto/vschema/vschema.pb.go @@ -38,6 +38,58 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type Keyspace_ForeignKeyMode int32 + +const ( + Keyspace_FK_DEFAULT Keyspace_ForeignKeyMode = 0 + Keyspace_FK_DISALLOW Keyspace_ForeignKeyMode = 1 + Keyspace_FK_UNMANAGED Keyspace_ForeignKeyMode = 2 + Keyspace_FK_MANAGED Keyspace_ForeignKeyMode = 3 +) + +// Enum value maps for Keyspace_ForeignKeyMode. +var ( + Keyspace_ForeignKeyMode_name = map[int32]string{ + 0: "FK_DEFAULT", + 1: "FK_DISALLOW", + 2: "FK_UNMANAGED", + 3: "FK_MANAGED", + } + Keyspace_ForeignKeyMode_value = map[string]int32{ + "FK_DEFAULT": 0, + "FK_DISALLOW": 1, + "FK_UNMANAGED": 2, + "FK_MANAGED": 3, + } +) + +func (x Keyspace_ForeignKeyMode) Enum() *Keyspace_ForeignKeyMode { + p := new(Keyspace_ForeignKeyMode) + *p = x + return p +} + +func (x Keyspace_ForeignKeyMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Keyspace_ForeignKeyMode) Descriptor() protoreflect.EnumDescriptor { + return file_vschema_proto_enumTypes[0].Descriptor() +} + +func (Keyspace_ForeignKeyMode) Type() protoreflect.EnumType { + return &file_vschema_proto_enumTypes[0] +} + +func (x Keyspace_ForeignKeyMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Keyspace_ForeignKeyMode.Descriptor instead. +func (Keyspace_ForeignKeyMode) EnumDescriptor() ([]byte, []int) { + return file_vschema_proto_rawDescGZIP(), []int{2, 0} +} + // RoutingRules specify the high level routing rules for the VSchema. type RoutingRules struct { state protoimpl.MessageState @@ -157,6 +209,8 @@ type Keyspace struct { Tables map[string]*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // If require_explicit_routing is true, vindexes and tables are not added to global routing RequireExplicitRouting bool `protobuf:"varint,4,opt,name=require_explicit_routing,json=requireExplicitRouting,proto3" json:"require_explicit_routing,omitempty"` + // foreign_key_mode dictates how Vitess should handle foreign keys for this keyspace. + ForeignKeyMode Keyspace_ForeignKeyMode `protobuf:"varint,5,opt,name=foreign_key_mode,json=foreignKeyMode,proto3,enum=vschema.Keyspace_ForeignKeyMode" json:"foreign_key_mode,omitempty"` } func (x *Keyspace) Reset() { @@ -219,6 +273,13 @@ func (x *Keyspace) GetRequireExplicitRouting() bool { return false } +func (x *Keyspace) GetForeignKeyMode() Keyspace_ForeignKeyMode { + if x != nil { + return x.ForeignKeyMode + } + return Keyspace_FK_DEFAULT +} + // Vindex is the vindex info for a Keyspace. type Vindex struct { state protoimpl.MessageState @@ -779,7 +840,7 @@ var file_vschema_proto_rawDesc = []byte{ 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0xeb, 0x02, 0x0a, + 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0x8c, 0x04, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x76, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, @@ -793,92 +854,102 @@ var file_vschema_proto_rawDesc = []byte{ 0x72, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, - 0x67, 0x1a, 0x4c, 0x0a, 0x0d, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x56, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, - 0x49, 0x0a, 0x0b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x67, 0x12, 0x4a, 0x0a, 0x10, 0x66, 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x5f, 0x6b, 0x65, 0x79, + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x76, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x46, + 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x0e, 0x66, + 0x6f, 0x72, 0x65, 0x69, 0x67, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x1a, 0x4c, 0x0a, + 0x0d, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa2, 0x01, 0x0a, 0x06, 0x56, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x76, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x2e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, - 0x77, 0x6e, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0xb1, 0x02, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3e, 0x0a, - 0x0f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x76, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0e, 0x63, - 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x12, 0x3d, 0x0a, - 0x0e, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, - 0x41, 0x75, 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, - 0x75, 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x07, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x69, 0x6e, 0x6e, 0x65, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x12, - 0x3a, 0x0a, 0x19, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x17, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x22, 0x54, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0x43, 0x0a, 0x0d, 0x41, 0x75, 0x74, - 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x3d, - 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xa7, 0x02, - 0x0a, 0x0a, 0x53, 0x72, 0x76, 0x56, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x40, 0x0a, 0x09, - 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x72, 0x76, 0x56, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x3a, - 0x0a, 0x0d, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, - 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x0c, 0x72, 0x6f, - 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x13, 0x73, 0x68, - 0x61, 0x72, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, - 0x6c, 0x65, 0x73, 0x52, 0x11, 0x73, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, - 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x1a, 0x4f, 0x0a, 0x0e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x44, 0x0a, 0x11, 0x53, 0x68, 0x61, 0x72, 0x64, - 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x05, - 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x76, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, - 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x6e, 0x0a, - 0x10, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, - 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x4b, 0x65, - 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x5f, 0x6b, 0x65, 0x79, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x6f, 0x4b, - 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x42, 0x26, 0x5a, - 0x24, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, - 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x49, 0x0a, 0x0b, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x53, 0x0a, 0x0e, 0x46, 0x6f, 0x72, 0x65, 0x69, 0x67, + 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x4b, 0x5f, 0x44, + 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x4b, 0x5f, 0x44, + 0x49, 0x53, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x4b, 0x5f, + 0x55, 0x4e, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x46, + 0x4b, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x44, 0x10, 0x03, 0x22, 0xa2, 0x01, 0x0a, 0x06, + 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x76, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0xb1, 0x02, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3e, + 0x0a, 0x0f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x76, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0e, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x12, 0x3d, + 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x2e, 0x41, 0x75, 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0d, + 0x61, 0x75, 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, + 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, + 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x69, 0x6e, 0x6e, + 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x69, 0x6e, 0x6e, 0x65, 0x64, + 0x12, 0x3a, 0x0a, 0x19, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x5f, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x17, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x22, 0x54, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x56, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x22, 0x43, 0x0a, 0x0d, 0x41, 0x75, + 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, + 0x3d, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xa7, + 0x02, 0x0a, 0x0a, 0x53, 0x72, 0x76, 0x56, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x40, 0x0a, + 0x09, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x72, 0x76, 0x56, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, + 0x3a, 0x0a, 0x0d, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x0c, 0x72, + 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x13, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75, 0x6c, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x76, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, + 0x75, 0x6c, 0x65, 0x73, 0x52, 0x11, 0x73, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, + 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x1a, 0x4f, 0x0a, 0x0e, 0x4b, 0x65, 0x79, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x44, 0x0a, 0x11, 0x53, 0x68, 0x61, 0x72, + 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x2f, 0x0a, + 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x76, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, + 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x6e, + 0x0a, 0x10, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, + 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x4b, + 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x5f, 0x6b, 0x65, + 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x6f, + 0x4b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x42, 0x26, + 0x5a, 0x24, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, + 0x73, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -893,46 +964,49 @@ func file_vschema_proto_rawDescGZIP() []byte { return file_vschema_proto_rawDescData } +var file_vschema_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_vschema_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_vschema_proto_goTypes = []interface{}{ - (*RoutingRules)(nil), // 0: vschema.RoutingRules - (*RoutingRule)(nil), // 1: vschema.RoutingRule - (*Keyspace)(nil), // 2: vschema.Keyspace - (*Vindex)(nil), // 3: vschema.Vindex - (*Table)(nil), // 4: vschema.Table - (*ColumnVindex)(nil), // 5: vschema.ColumnVindex - (*AutoIncrement)(nil), // 6: vschema.AutoIncrement - (*Column)(nil), // 7: vschema.Column - (*SrvVSchema)(nil), // 8: vschema.SrvVSchema - (*ShardRoutingRules)(nil), // 9: vschema.ShardRoutingRules - (*ShardRoutingRule)(nil), // 10: vschema.ShardRoutingRule - nil, // 11: vschema.Keyspace.VindexesEntry - nil, // 12: vschema.Keyspace.TablesEntry - nil, // 13: vschema.Vindex.ParamsEntry - nil, // 14: vschema.SrvVSchema.KeyspacesEntry - (query.Type)(0), // 15: query.Type + (Keyspace_ForeignKeyMode)(0), // 0: vschema.Keyspace.ForeignKeyMode + (*RoutingRules)(nil), // 1: vschema.RoutingRules + (*RoutingRule)(nil), // 2: vschema.RoutingRule + (*Keyspace)(nil), // 3: vschema.Keyspace + (*Vindex)(nil), // 4: vschema.Vindex + (*Table)(nil), // 5: vschema.Table + (*ColumnVindex)(nil), // 6: vschema.ColumnVindex + (*AutoIncrement)(nil), // 7: vschema.AutoIncrement + (*Column)(nil), // 8: vschema.Column + (*SrvVSchema)(nil), // 9: vschema.SrvVSchema + (*ShardRoutingRules)(nil), // 10: vschema.ShardRoutingRules + (*ShardRoutingRule)(nil), // 11: vschema.ShardRoutingRule + nil, // 12: vschema.Keyspace.VindexesEntry + nil, // 13: vschema.Keyspace.TablesEntry + nil, // 14: vschema.Vindex.ParamsEntry + nil, // 15: vschema.SrvVSchema.KeyspacesEntry + (query.Type)(0), // 16: query.Type } var file_vschema_proto_depIdxs = []int32{ - 1, // 0: vschema.RoutingRules.rules:type_name -> vschema.RoutingRule - 11, // 1: vschema.Keyspace.vindexes:type_name -> vschema.Keyspace.VindexesEntry - 12, // 2: vschema.Keyspace.tables:type_name -> vschema.Keyspace.TablesEntry - 13, // 3: vschema.Vindex.params:type_name -> vschema.Vindex.ParamsEntry - 5, // 4: vschema.Table.column_vindexes:type_name -> vschema.ColumnVindex - 6, // 5: vschema.Table.auto_increment:type_name -> vschema.AutoIncrement - 7, // 6: vschema.Table.columns:type_name -> vschema.Column - 15, // 7: vschema.Column.type:type_name -> query.Type - 14, // 8: vschema.SrvVSchema.keyspaces:type_name -> vschema.SrvVSchema.KeyspacesEntry - 0, // 9: vschema.SrvVSchema.routing_rules:type_name -> vschema.RoutingRules - 9, // 10: vschema.SrvVSchema.shard_routing_rules:type_name -> vschema.ShardRoutingRules - 10, // 11: vschema.ShardRoutingRules.rules:type_name -> vschema.ShardRoutingRule - 3, // 12: vschema.Keyspace.VindexesEntry.value:type_name -> vschema.Vindex - 4, // 13: vschema.Keyspace.TablesEntry.value:type_name -> vschema.Table - 2, // 14: vschema.SrvVSchema.KeyspacesEntry.value:type_name -> vschema.Keyspace - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 2, // 0: vschema.RoutingRules.rules:type_name -> vschema.RoutingRule + 12, // 1: vschema.Keyspace.vindexes:type_name -> vschema.Keyspace.VindexesEntry + 13, // 2: vschema.Keyspace.tables:type_name -> vschema.Keyspace.TablesEntry + 0, // 3: vschema.Keyspace.foreign_key_mode:type_name -> vschema.Keyspace.ForeignKeyMode + 14, // 4: vschema.Vindex.params:type_name -> vschema.Vindex.ParamsEntry + 6, // 5: vschema.Table.column_vindexes:type_name -> vschema.ColumnVindex + 7, // 6: vschema.Table.auto_increment:type_name -> vschema.AutoIncrement + 8, // 7: vschema.Table.columns:type_name -> vschema.Column + 16, // 8: vschema.Column.type:type_name -> query.Type + 15, // 9: vschema.SrvVSchema.keyspaces:type_name -> vschema.SrvVSchema.KeyspacesEntry + 1, // 10: vschema.SrvVSchema.routing_rules:type_name -> vschema.RoutingRules + 10, // 11: vschema.SrvVSchema.shard_routing_rules:type_name -> vschema.ShardRoutingRules + 11, // 12: vschema.ShardRoutingRules.rules:type_name -> vschema.ShardRoutingRule + 4, // 13: vschema.Keyspace.VindexesEntry.value:type_name -> vschema.Vindex + 5, // 14: vschema.Keyspace.TablesEntry.value:type_name -> vschema.Table + 3, // 15: vschema.SrvVSchema.KeyspacesEntry.value:type_name -> vschema.Keyspace + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_vschema_proto_init() } @@ -1079,13 +1153,14 @@ func file_vschema_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_vschema_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 15, NumExtensions: 0, NumServices: 0, }, GoTypes: file_vschema_proto_goTypes, DependencyIndexes: file_vschema_proto_depIdxs, + EnumInfos: file_vschema_proto_enumTypes, MessageInfos: file_vschema_proto_msgTypes, }.Build() File_vschema_proto = out.File diff --git a/go/vt/proto/vschema/vschema_vtproto.pb.go b/go/vt/proto/vschema/vschema_vtproto.pb.go index 1b461eba1ff..38d7a422834 100644 --- a/go/vt/proto/vschema/vschema_vtproto.pb.go +++ b/go/vt/proto/vschema/vschema_vtproto.pb.go @@ -143,6 +143,11 @@ func (m *Keyspace) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.ForeignKeyMode != 0 { + i = encodeVarint(dAtA, i, uint64(m.ForeignKeyMode)) + i-- + dAtA[i] = 0x28 + } if m.RequireExplicitRouting { i-- if m.RequireExplicitRouting { @@ -781,6 +786,9 @@ func (m *Keyspace) SizeVT() (n int) { if m.RequireExplicitRouting { n += 2 } + if m.ForeignKeyMode != 0 { + n += 1 + sov(uint64(m.ForeignKeyMode)) + } n += len(m.unknownFields) return n } @@ -1513,6 +1521,25 @@ func (m *Keyspace) UnmarshalVT(dAtA []byte) error { } } m.RequireExplicitRouting = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ForeignKeyMode", wireType) + } + m.ForeignKeyMode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ForeignKeyMode |= Keyspace_ForeignKeyMode(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/go/vt/vtgate/vindexes/vschema.go b/go/vt/vtgate/vindexes/vschema.go index b62b5ce46f7..90becdf275f 100644 --- a/go/vt/vtgate/vindexes/vschema.go +++ b/go/vt/vtgate/vindexes/vschema.go @@ -175,19 +175,21 @@ func (col *Column) MarshalJSON() ([]byte, error) { // KeyspaceSchema contains the schema(table) for a keyspace. type KeyspaceSchema struct { - Keyspace *Keyspace - Tables map[string]*Table - Vindexes map[string]Vindex - Views map[string]sqlparser.SelectStatement - Error error + Keyspace *Keyspace + ForeignKeyMode vschemapb.Keyspace_ForeignKeyMode + Tables map[string]*Table + Vindexes map[string]Vindex + Views map[string]sqlparser.SelectStatement + Error error } type ksJSON struct { - Sharded bool `json:"sharded,omitempty"` - Tables map[string]*Table `json:"tables,omitempty"` - Vindexes map[string]Vindex `json:"vindexes,omitempty"` - Views map[string]string `json:"views,omitempty"` - Error string `json:"error,omitempty"` + Sharded bool `json:"sharded,omitempty"` + ForeignKeyMode string `json:"foreignKeyMode,omitempty"` + Tables map[string]*Table `json:"tables,omitempty"` + Vindexes map[string]Vindex `json:"vindexes,omitempty"` + Views map[string]string `json:"views,omitempty"` + Error string `json:"error,omitempty"` } // findTable looks for the table with the requested tablename in the keyspace. @@ -216,9 +218,10 @@ func (ks *KeyspaceSchema) findTable( // MarshalJSON returns a JSON representation of KeyspaceSchema. func (ks *KeyspaceSchema) MarshalJSON() ([]byte, error) { ksJ := ksJSON{ - Sharded: ks.Keyspace.Sharded, - Tables: ks.Tables, - Vindexes: ks.Vindexes, + Sharded: ks.Keyspace.Sharded, + Tables: ks.Tables, + ForeignKeyMode: ks.ForeignKeyMode.String(), + Vindexes: ks.Vindexes, } if ks.Error != nil { ksJ.Error = ks.Error.Error() @@ -304,14 +307,23 @@ func buildKeyspaces(source *vschemapb.SrvVSchema, vschema *VSchema) { Name: ksname, Sharded: ks.Sharded, }, - Tables: make(map[string]*Table), - Vindexes: make(map[string]Vindex), + ForeignKeyMode: replaceDefaultForeignKeyMode(ks.ForeignKeyMode), + Tables: make(map[string]*Table), + Vindexes: make(map[string]Vindex), } vschema.Keyspaces[ksname] = ksvschema ksvschema.Error = buildTables(ks, vschema, ksvschema) } } +// replaceDefaultForeignKeyMode replaces the default value of the foreign key mode enum with the default we want to keep. +func replaceDefaultForeignKeyMode(fkMode vschemapb.Keyspace_ForeignKeyMode) vschemapb.Keyspace_ForeignKeyMode { + if fkMode == vschemapb.Keyspace_FK_DEFAULT { + return vschemapb.Keyspace_FK_UNMANAGED + } + return fkMode +} + func (vschema *VSchema) AddView(ksname string, viewName, query string) error { ks, ok := vschema.Keyspaces[ksname] if !ok { diff --git a/go/vt/vtgate/vindexes/vschema_test.go b/go/vt/vtgate/vindexes/vschema_test.go index 9f538d20d0b..c7257e0a633 100644 --- a/go/vt/vtgate/vindexes/vschema_test.go +++ b/go/vt/vtgate/vindexes/vschema_test.go @@ -243,6 +243,45 @@ func TestUnshardedVSchemaValid(t *testing.T) { require.NoError(t, err) } +func TestForeignKeyMode(t *testing.T) { + tests := []struct { + name string + fkMode vschemapb.Keyspace_ForeignKeyMode + wantedFkMode vschemapb.Keyspace_ForeignKeyMode + }{ + { + name: "Default Value", + wantedFkMode: vschemapb.Keyspace_FK_UNMANAGED, + }, { + name: "Managed Value", + fkMode: vschemapb.Keyspace_FK_MANAGED, + wantedFkMode: vschemapb.Keyspace_FK_MANAGED, + }, { + name: "Unmanaged Value", + fkMode: vschemapb.Keyspace_FK_UNMANAGED, + wantedFkMode: vschemapb.Keyspace_FK_UNMANAGED, + }, { + name: "Disallow Value", + fkMode: vschemapb.Keyspace_FK_DISALLOW, + wantedFkMode: vschemapb.Keyspace_FK_DISALLOW, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ksSchema, err := BuildKeyspace(&vschemapb.Keyspace{ + Sharded: false, + ForeignKeyMode: test.fkMode, + Vindexes: make(map[string]*vschemapb.Vindex), + Tables: make(map[string]*vschemapb.Table), + }) + require.NoError(t, err) + require.Equal(t, test.wantedFkMode, ksSchema.ForeignKeyMode) + }) + + } +} + func TestUnshardedVSchema(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ @@ -318,6 +357,7 @@ func TestVSchemaViews(t *testing.T) { got := string(out) want := ` { + "foreignKeyMode":"FK_UNMANAGED", "tables": { "t1": { "name": "t1", @@ -562,7 +602,8 @@ func TestVSchemaRoutingRules(t *testing.T) { }, Keyspaces: map[string]*vschemapb.Keyspace{ "ks1": { - Sharded: true, + Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Vindexes: map[string]*vschemapb.Vindex{ "stfu1": { Type: "stfu", @@ -580,6 +621,7 @@ func TestVSchemaRoutingRules(t *testing.T) { }, }, "ks2": { + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, Tables: map[string]*vschemapb.Table{ "t2": {}, }, @@ -652,7 +694,8 @@ func TestVSchemaRoutingRules(t *testing.T) { }, Keyspaces: map[string]*KeyspaceSchema{ "ks1": { - Keyspace: ks1, + Keyspace: ks1, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Tables: map[string]*Table{ "t1": t1, }, @@ -661,7 +704,8 @@ func TestVSchemaRoutingRules(t *testing.T) { }, }, "ks2": { - Keyspace: ks2, + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, + Keyspace: ks2, Tables: map[string]*Table{ "t2": t2, }, @@ -980,7 +1024,8 @@ func TestShardedVSchemaMultiColumnVindex(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "sharded": { - Sharded: true, + Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_DISALLOW, Vindexes: map[string]*vschemapb.Vindex{ "stfu1": { Type: "stfu", @@ -1027,7 +1072,8 @@ func TestShardedVSchemaMultiColumnVindex(t *testing.T) { }, Keyspaces: map[string]*KeyspaceSchema{ "sharded": { - Keyspace: ks, + ForeignKeyMode: vschemapb.Keyspace_FK_DISALLOW, + Keyspace: ks, Tables: map[string]*Table{ "t1": t1}, Vindexes: map[string]Vindex{ @@ -1044,7 +1090,8 @@ func TestShardedVSchemaNotOwned(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "sharded": { - Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, + Sharded: true, Vindexes: map[string]*vschemapb.Vindex{ "stlu1": { Type: "stlu", @@ -1101,7 +1148,8 @@ func TestShardedVSchemaNotOwned(t *testing.T) { "stfu1": vindex2}, Keyspaces: map[string]*KeyspaceSchema{ "sharded": { - Keyspace: ks, + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, + Keyspace: ks, Tables: map[string]*Table{ "t1": t1, }, @@ -1175,10 +1223,12 @@ func TestBuildVSchemaDupSeq(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "ksa": { + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, Tables: map[string]*vschemapb.Table{ "t1": { Type: "sequence"}}}, "ksb": { + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, Tables: map[string]*vschemapb.Table{ "t1": { Type: "sequence"}}}}} @@ -1203,14 +1253,16 @@ func TestBuildVSchemaDupSeq(t *testing.T) { uniqueVindexes: map[string]Vindex{}, Keyspaces: map[string]*KeyspaceSchema{ "ksa": { - Keyspace: ksa, + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, + Keyspace: ksa, Tables: map[string]*Table{ "t1": t1a, }, Vindexes: map[string]Vindex{}, }, "ksb": { - Keyspace: ksb, + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, + Keyspace: ksb, Tables: map[string]*Table{ "t1": t1b, }, @@ -1226,11 +1278,13 @@ func TestBuildVSchemaDupTable(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "ksa": { + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Tables: map[string]*vschemapb.Table{ "t1": {}, }, }, "ksb": { + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Tables: map[string]*vschemapb.Table{ "t1": {}, }, @@ -1260,14 +1314,16 @@ func TestBuildVSchemaDupTable(t *testing.T) { uniqueVindexes: map[string]Vindex{}, Keyspaces: map[string]*KeyspaceSchema{ "ksa": { - Keyspace: ksa, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Keyspace: ksa, Tables: map[string]*Table{ "t1": t1a, }, Vindexes: map[string]Vindex{}, }, "ksb": { - Keyspace: ksb, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Keyspace: ksb, Tables: map[string]*Table{ "t1": t1b, }, @@ -1286,7 +1342,8 @@ func TestBuildVSchemaDupVindex(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "ksa": { - Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Sharded: true, Vindexes: map[string]*vschemapb.Vindex{ "stlu1": { Type: "stlu", @@ -1305,7 +1362,8 @@ func TestBuildVSchemaDupVindex(t *testing.T) { }, }, "ksb": { - Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Sharded: true, Vindexes: map[string]*vschemapb.Vindex{ "stlu1": { Type: "stlu", @@ -1387,7 +1445,8 @@ func TestBuildVSchemaDupVindex(t *testing.T) { }, Keyspaces: map[string]*KeyspaceSchema{ "ksa": { - Keyspace: ksa, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Keyspace: ksa, Tables: map[string]*Table{ "t1": t1, }, @@ -1396,7 +1455,8 @@ func TestBuildVSchemaDupVindex(t *testing.T) { }, }, "ksb": { - Keyspace: ksb, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Keyspace: ksb, Tables: map[string]*Table{ "t1": t2, }, @@ -1854,6 +1914,7 @@ func TestSequence(t *testing.T) { good := vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "unsharded": { + ForeignKeyMode: vschemapb.Keyspace_FK_DISALLOW, Tables: map[string]*vschemapb.Table{ "seq": { Type: "sequence", @@ -1861,7 +1922,8 @@ func TestSequence(t *testing.T) { }, }, "sharded": { - Sharded: true, + Sharded: true, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Vindexes: map[string]*vschemapb.Vindex{ "stfu1": { Type: "stfu", @@ -1971,14 +2033,16 @@ func TestSequence(t *testing.T) { }, Keyspaces: map[string]*KeyspaceSchema{ "unsharded": { - Keyspace: ksu, + ForeignKeyMode: vschemapb.Keyspace_FK_DISALLOW, + Keyspace: ksu, Tables: map[string]*Table{ "seq": seq, }, Vindexes: map[string]Vindex{}, }, "sharded": { - Keyspace: kss, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Keyspace: kss, Tables: map[string]*Table{ "t1": t1, "t2": t2, @@ -2407,7 +2471,8 @@ func TestBuildKeyspaceSchema(t *testing.T) { Keyspace: ks, } want := &KeyspaceSchema{ - Keyspace: ks, + Keyspace: ks, + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, Tables: map[string]*Table{ "t1": t1, "t2": t2, @@ -2529,6 +2594,7 @@ func TestVSchemaJSON(t *testing.T) { in := map[string]*KeyspaceSchema{ "unsharded": { + ForeignKeyMode: vschemapb.Keyspace_FK_MANAGED, Keyspace: &Keyspace{ Name: "k1", }, @@ -2549,6 +2615,7 @@ func TestVSchemaJSON(t *testing.T) { }, }, "sharded": { + ForeignKeyMode: vschemapb.Keyspace_FK_DISALLOW, Keyspace: &Keyspace{ Name: "k2", Sharded: true, @@ -2575,6 +2642,7 @@ func TestVSchemaJSON(t *testing.T) { want := `{ "sharded": { "sharded": true, + "foreignKeyMode": "FK_DISALLOW", "tables": { "t3": { "name": "n3", @@ -2599,6 +2667,7 @@ func TestVSchemaJSON(t *testing.T) { } }, "unsharded": { + "foreignKeyMode": "FK_MANAGED", "tables": { "t1": { "name": "n1", diff --git a/go/vt/vtgate/vschema_manager_test.go b/go/vt/vtgate/vschema_manager_test.go index 7e9a9224371..4aa81442f38 100644 --- a/go/vt/vtgate/vschema_manager_test.go +++ b/go/vt/vtgate/vschema_manager_test.go @@ -222,8 +222,10 @@ func makeTestVSchema(ks string, sharded bool, tbls map[string]*vindexes.Table) * Name: ks, Sharded: sharded, }, - Tables: tbls, - Vindexes: map[string]vindexes.Vindex{}, + // Default foreign key mode + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, + Tables: tbls, + Vindexes: map[string]vindexes.Vindex{}, } vs := makeTestEmptyVSchema() vs.Keyspaces[ks] = keyspaceSchema @@ -241,6 +243,8 @@ func makeTestSrvVSchema(ks string, sharded bool, tbls map[string]*vschemapb.Tabl keyspaceSchema := &vschemapb.Keyspace{ Sharded: sharded, Tables: tbls, + // Default foreign key mode + ForeignKeyMode: vschemapb.Keyspace_FK_UNMANAGED, } return &vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ks: keyspaceSchema}, diff --git a/go/vt/vttablet/tabletserver/vstreamer/engine_test.go b/go/vt/vttablet/tabletserver/vstreamer/engine_test.go index 7324e59c3b9..825d251365a 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/engine_test.go +++ b/go/vt/vttablet/tabletserver/vstreamer/engine_test.go @@ -110,6 +110,7 @@ func TestUpdateVSchema(t *testing.T) { "keyspaces": { "vttest": { "sharded": true, + "foreignKeyMode": "FK_UNMANAGED", "tables": { "t1": { "name": "t1", diff --git a/proto/vschema.proto b/proto/vschema.proto index f618492693c..ea6482a4825 100644 --- a/proto/vschema.proto +++ b/proto/vschema.proto @@ -45,6 +45,15 @@ message Keyspace { map tables = 3; // If require_explicit_routing is true, vindexes and tables are not added to global routing bool require_explicit_routing = 4; + // foreign_key_mode dictates how Vitess should handle foreign keys for this keyspace. + ForeignKeyMode foreign_key_mode = 5; + + enum ForeignKeyMode { + FK_DEFAULT = 0; + FK_DISALLOW = 1; + FK_UNMANAGED = 2; + FK_MANAGED = 3; + } } // Vindex is the vindex info for a Keyspace. diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index 6d1c9ab8f22..7682b62e463 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -39381,6 +39381,9 @@ export namespace vschema { /** Keyspace require_explicit_routing */ require_explicit_routing?: (boolean|null); + + /** Keyspace foreign_key_mode */ + foreign_key_mode?: (vschema.Keyspace.ForeignKeyMode|null); } /** Represents a Keyspace. */ @@ -39404,6 +39407,9 @@ export namespace vschema { /** Keyspace require_explicit_routing. */ public require_explicit_routing: boolean; + /** Keyspace foreign_key_mode. */ + public foreign_key_mode: vschema.Keyspace.ForeignKeyMode; + /** * Creates a new Keyspace instance using the specified properties. * @param [properties] Properties to set @@ -39482,6 +39488,17 @@ export namespace vschema { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace Keyspace { + + /** ForeignKeyMode enum. */ + enum ForeignKeyMode { + FK_DEFAULT = 0, + FK_DISALLOW = 1, + FK_UNMANAGED = 2, + FK_MANAGED = 3 + } + } + /** Properties of a Vindex. */ interface IVindex { diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index becbedaee74..006cef2e714 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -94903,6 +94903,7 @@ export const vschema = $root.vschema = (() => { * @property {Object.|null} [vindexes] Keyspace vindexes * @property {Object.|null} [tables] Keyspace tables * @property {boolean|null} [require_explicit_routing] Keyspace require_explicit_routing + * @property {vschema.Keyspace.ForeignKeyMode|null} [foreign_key_mode] Keyspace foreign_key_mode */ /** @@ -94954,6 +94955,14 @@ export const vschema = $root.vschema = (() => { */ Keyspace.prototype.require_explicit_routing = false; + /** + * Keyspace foreign_key_mode. + * @member {vschema.Keyspace.ForeignKeyMode} foreign_key_mode + * @memberof vschema.Keyspace + * @instance + */ + Keyspace.prototype.foreign_key_mode = 0; + /** * Creates a new Keyspace instance using the specified properties. * @function create @@ -94992,6 +95001,8 @@ export const vschema = $root.vschema = (() => { } if (message.require_explicit_routing != null && Object.hasOwnProperty.call(message, "require_explicit_routing")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.require_explicit_routing); + if (message.foreign_key_mode != null && Object.hasOwnProperty.call(message, "foreign_key_mode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.foreign_key_mode); return writer; }; @@ -95080,6 +95091,10 @@ export const vschema = $root.vschema = (() => { message.require_explicit_routing = reader.bool(); break; } + case 5: { + message.foreign_key_mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -95141,6 +95156,16 @@ export const vschema = $root.vschema = (() => { if (message.require_explicit_routing != null && message.hasOwnProperty("require_explicit_routing")) if (typeof message.require_explicit_routing !== "boolean") return "require_explicit_routing: boolean expected"; + if (message.foreign_key_mode != null && message.hasOwnProperty("foreign_key_mode")) + switch (message.foreign_key_mode) { + default: + return "foreign_key_mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } return null; }; @@ -95180,6 +95205,30 @@ export const vschema = $root.vschema = (() => { } if (object.require_explicit_routing != null) message.require_explicit_routing = Boolean(object.require_explicit_routing); + switch (object.foreign_key_mode) { + default: + if (typeof object.foreign_key_mode === "number") { + message.foreign_key_mode = object.foreign_key_mode; + break; + } + break; + case "FK_DEFAULT": + case 0: + message.foreign_key_mode = 0; + break; + case "FK_DISALLOW": + case 1: + message.foreign_key_mode = 1; + break; + case "FK_UNMANAGED": + case 2: + message.foreign_key_mode = 2; + break; + case "FK_MANAGED": + case 3: + message.foreign_key_mode = 3; + break; + } return message; }; @@ -95203,6 +95252,7 @@ export const vschema = $root.vschema = (() => { if (options.defaults) { object.sharded = false; object.require_explicit_routing = false; + object.foreign_key_mode = options.enums === String ? "FK_DEFAULT" : 0; } if (message.sharded != null && message.hasOwnProperty("sharded")) object.sharded = message.sharded; @@ -95219,6 +95269,8 @@ export const vschema = $root.vschema = (() => { } if (message.require_explicit_routing != null && message.hasOwnProperty("require_explicit_routing")) object.require_explicit_routing = message.require_explicit_routing; + if (message.foreign_key_mode != null && message.hasOwnProperty("foreign_key_mode")) + object.foreign_key_mode = options.enums === String ? $root.vschema.Keyspace.ForeignKeyMode[message.foreign_key_mode] === undefined ? message.foreign_key_mode : $root.vschema.Keyspace.ForeignKeyMode[message.foreign_key_mode] : message.foreign_key_mode; return object; }; @@ -95248,6 +95300,24 @@ export const vschema = $root.vschema = (() => { return typeUrlPrefix + "/vschema.Keyspace"; }; + /** + * ForeignKeyMode enum. + * @name vschema.Keyspace.ForeignKeyMode + * @enum {number} + * @property {number} FK_DEFAULT=0 FK_DEFAULT value + * @property {number} FK_DISALLOW=1 FK_DISALLOW value + * @property {number} FK_UNMANAGED=2 FK_UNMANAGED value + * @property {number} FK_MANAGED=3 FK_MANAGED value + */ + Keyspace.ForeignKeyMode = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FK_DEFAULT"] = 0; + values[valuesById[1] = "FK_DISALLOW"] = 1; + values[valuesById[2] = "FK_UNMANAGED"] = 2; + values[valuesById[3] = "FK_MANAGED"] = 3; + return values; + })(); + return Keyspace; })();