Skip to content

Commit

Permalink
#18 Fix foreign key query panic
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Sep 23, 2021
1 parent 8f9a91c commit f5cb8b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mysql/query/foreign_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ impl SchemaQueryBuilder {
Expr::tbl(Schema::KeyColumnUsage, Key::ConstraintSchema).eq(schema.to_string()),
)
.and_where(Expr::tbl(Schema::KeyColumnUsage, Key::TableName).eq(table.to_string()))
.and_where(Expr::tbl(Schema::KeyColumnUsage, Key::ReferencedTableName).is_not_null())
.and_where(Expr::tbl(Schema::KeyColumnUsage, Key::ReferencedColumnName).is_not_null())
.order_by(Key::ConstraintName, Order::Asc)
.order_by(Key::OrdinalPosition, Order::Asc)
.take()
Expand Down

0 comments on commit f5cb8b4

Please sign in to comment.