@@ -548,10 +548,10 @@ where
548
548
fn sql_for_op ( current : & mut ADB , op : & Operation ) -> Result < String > {
549
549
match op {
550
550
Operation :: AddTable ( table) => Ok ( create_table ( table, false ) ?) ,
551
- Operation :: AddTableConstraints ( table) => Ok ( create_table_constraints ( table) ) ,
551
+ Operation :: AddTableConstraints ( table) => Ok ( create_table_fkey_constraints ( table) ) ,
552
552
Operation :: AddTableIfNotExists ( table) => Ok ( create_table ( table, true ) ?) ,
553
553
Operation :: RemoveTable ( name) => Ok ( drop_table ( name) ) ,
554
- Operation :: RemoveTableConstraints ( table) => remove_table_constraints ( table) ,
554
+ Operation :: RemoveTableConstraints ( table) => remove_table_fkey_constraints ( table) ,
555
555
Operation :: AddColumn ( tbl, col) => add_column ( tbl, col) ,
556
556
Operation :: RemoveColumn ( tbl, name) => Ok ( remove_column ( tbl, name) ) ,
557
557
Operation :: ChangeColumn ( tbl, old, new) => {
@@ -586,22 +586,22 @@ fn create_table(table: &ATable, allow_exists: bool) -> Result<String> {
586
586
) )
587
587
}
588
588
589
- fn create_table_constraints ( table : & ATable ) -> String {
589
+ fn create_table_fkey_constraints ( table : & ATable ) -> String {
590
590
table
591
591
. columns
592
592
. iter ( )
593
593
. filter ( |column| column. reference ( ) . is_some ( ) )
594
- . map ( |column| define_constraint ( & table. name , column) )
594
+ . map ( |column| define_fkey_constraint ( & table. name , column) )
595
595
. collect :: < Vec < String > > ( )
596
596
. join ( "\n " )
597
597
}
598
598
599
- fn remove_table_constraints ( table : & ATable ) -> Result < String > {
599
+ fn remove_table_fkey_constraints ( table : & ATable ) -> Result < String > {
600
600
Ok ( table
601
601
. columns
602
602
. iter ( )
603
603
. filter ( |column| column. reference ( ) . is_some ( ) )
604
- . map ( |column| drop_fk_constraints ( table, column) )
604
+ . map ( |column| drop_fkey_constraints ( table, column) )
605
605
. collect :: < Result < Vec < String > > > ( ) ?
606
606
. join ( "\n " ) )
607
607
}
@@ -632,7 +632,7 @@ fn define_column(col: &AColumn) -> Result<String> {
632
632
) )
633
633
}
634
634
635
- fn define_constraint ( table_name : & str , column : & AColumn ) -> String {
635
+ fn define_fkey_constraint ( table_name : & str , column : & AColumn ) -> String {
636
636
let reference = column
637
637
. reference ( )
638
638
. as_ref ( )
@@ -651,7 +651,7 @@ fn define_constraint(table_name: &str, column: &AColumn) -> String {
651
651
}
652
652
}
653
653
654
- fn drop_fk_constraints ( table : & ATable , column : & AColumn ) -> Result < String > {
654
+ fn drop_fkey_constraints ( table : & ATable , column : & AColumn ) -> Result < String > {
655
655
let mut modified_column = column. clone ( ) ;
656
656
modified_column. remove_reference ( ) ;
657
657
change_column ( table, column, & modified_column)
0 commit comments