MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / query_mysql_foreign_keys

Function query_mysql_foreign_keys

sea-orm-migration/src/migrator.rs:486–514  ·  view source on GitHub ↗
(db: &C)

Source from the content-addressed store, hash-verified

484}
485
486fn query_mysql_foreign_keys<C>(db: &C) -> SelectStatement
487where
488 C: ConnectionTrait,
489{
490 let mut stmt = Query::select();
491 stmt.columns([
492 InformationSchema::TableName,
493 InformationSchema::ConstraintName,
494 ])
495 .from((
496 InformationSchema::Schema,
497 InformationSchema::TableConstraints,
498 ))
499 .cond_where(
500 Condition::all()
501 .add(get_current_schema(db).equals((
502 InformationSchema::TableConstraints,
503 InformationSchema::TableSchema,
504 )))
505 .add(
506 Expr::col((
507 InformationSchema::TableConstraints,
508 InformationSchema::ConstraintType,
509 ))
510 .eq("FOREIGN KEY"),
511 ),
512 );
513 stmt
514}
515
516#[derive(DeriveIden)]
517enum PgType {

Callers 1

exec_freshFunction · 0.85

Calls 5

get_current_schemaFunction · 0.85
columnsMethod · 0.80
addMethod · 0.80
fromMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected