mirror of
https://github.com/ent/ent.git
synced 2026-05-05 17:10:54 +03:00
dialect/sql/schema: schema match from predicate
This commit is contained in:
committed by
Ariel Mashraki
parent
7e904f0e1c
commit
cc8da8fbf7
@@ -545,8 +545,8 @@ func (m *Migrate) fkColumn(ctx context.Context, tx dialect.Tx, fk *ForeignKey) (
|
||||
On(t1.C("constraint_name"), t2.C("constraint_name")).
|
||||
Where(sql.And(
|
||||
sql.EQ(t2.C("constraint_type"), sql.Raw("'FOREIGN KEY'")),
|
||||
sql.EQ(t2.C("table_schema"), m.sqlDialect.(fkRenamer).tableSchema()),
|
||||
sql.EQ(t1.C("table_schema"), m.sqlDialect.(fkRenamer).tableSchema()),
|
||||
m.sqlDialect.(fkRenamer).matchSchema(t2.C("table_schema")),
|
||||
m.sqlDialect.(fkRenamer).matchSchema(t1.C("table_schema")),
|
||||
sql.EQ(t2.C("constraint_name"), fk.Symbol),
|
||||
)).
|
||||
Query()
|
||||
@@ -656,7 +656,7 @@ type preparer interface {
|
||||
// fkRenamer is used by the fixture migration (to solve #285),
|
||||
// and it's implemented by the different dialects for renaming FKs.
|
||||
type fkRenamer interface {
|
||||
tableSchema() sql.Querier
|
||||
matchSchema(...string) *sql.Predicate
|
||||
isImplicitIndex(*Index, *Column) bool
|
||||
renameIndex(*Table, *Index, *Index) sql.Querier
|
||||
renameColumn(*Table, *Column, *Column) sql.Querier
|
||||
|
||||
Reference in New Issue
Block a user