diff --git a/go/vt/vtgate/engine/fk_verify.go b/go/vt/vtgate/engine/fk_verify.go index 5879be45610..350aeec59e0 100644 --- a/go/vt/vtgate/engine/fk_verify.go +++ b/go/vt/vtgate/engine/fk_verify.go @@ -26,6 +26,7 @@ import ( "vitess.io/vitess/go/vt/vterrors" ) +// Verify contains the verification primitve and its type i.e. parent or child type Verify struct { Exec Primitive Typ string @@ -40,6 +41,7 @@ type FkVerify struct { txNeeded } +// constants for verification type. const ( ParentVerify = "VerifyParent" ChildVerify = "VerifyChild" diff --git a/go/vt/vtgate/planbuilder/plan_test.go b/go/vt/vtgate/planbuilder/plan_test.go index 6ab86725109..9bd1778ab6c 100644 --- a/go/vt/vtgate/planbuilder/plan_test.go +++ b/go/vt/vtgate/planbuilder/plan_test.go @@ -28,14 +28,12 @@ import ( "strings" "testing" - "vitess.io/vitess/go/test/vschemawrapper" - querypb "vitess.io/vitess/go/vt/proto/query" - "github.com/nsf/jsondiff" "github.com/stretchr/testify/require" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/test/utils" + "vitess.io/vitess/go/test/vschemawrapper" "vitess.io/vitess/go/vt/key" topodatapb "vitess.io/vitess/go/vt/proto/topodata" "vitess.io/vitess/go/vt/servenv" @@ -126,7 +124,6 @@ func setFks(t *testing.T, vschema *vindexes.VSchema) { _ = vschema.AddForeignKey("sharded_fk_allow", "tbl10", createFkDefinition([]string{"sk", "col"}, "tbl2", []string{"col2", "col"}, sqlparser.Restrict, sqlparser.Restrict)) // FK from tbl10 referencing tbl3 that is not shard scoped. _ = vschema.AddForeignKey("sharded_fk_allow", "tbl10", createFkDefinition([]string{"col"}, "tbl3", []string{"col"}, sqlparser.Restrict, sqlparser.Restrict)) - setCol(t, vschema, "sharded_fk_allow", "tbl3", "col", sqltypes.VarChar, "CollationUtf8mb4ID") // FK from tbl4 referencing tbl5 that is shard scoped. _ = vschema.AddForeignKey("sharded_fk_allow", "tbl4", createFkDefinition([]string{"col4"}, "tbl5", []string{"col5"}, sqlparser.SetNull, sqlparser.Cascade)) @@ -172,12 +169,6 @@ func setFks(t *testing.T, vschema *vindexes.VSchema) { } } -func setCol(t *testing.T, vschema *vindexes.VSchema, ks string, name string, col string, typ querypb.Type, coll string) { - tbl, err := vschema.FindTable(ks, name) - require.NoError(t, err) - tbl.Columns = append(tbl.Columns, vindexes.Column{Name: sqlparser.NewIdentifierCI(col), Type: typ, CollationName: coll}) -} - func TestSystemTables57(t *testing.T) { // first we move everything to use 5.7 logic oldVer := servenv.MySQLServerVersion() diff --git a/go/vt/vtgate/vindexes/vschema.go b/go/vt/vtgate/vindexes/vschema.go index b66e9e692ff..53c6dba6304 100644 --- a/go/vt/vtgate/vindexes/vschema.go +++ b/go/vt/vtgate/vindexes/vschema.go @@ -1336,12 +1336,3 @@ func (t *Table) getReferenceInKeyspace(keyspace string) *Table { } return t } - -func (t *Table) FindColumn(column sqlparser.IdentifierCI) *Column { - for _, c := range t.Columns { - if c.Name.Equal(column) { - return &c - } - } - return nil -}