Selaa lähdekoodia

Change foreign key relationships to be ON DELETE CASCADE by default.

Kestrel 2 vuotta sitten
vanhempi
commit
27789c8c78
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      microrm/src/model/create.rs

+ 1 - 1
microrm/src/model/create.rs

@@ -159,7 +159,7 @@ pub fn sql_for_table<T: crate::model::Entity>() -> (String, String) {
 
         let fk = fk.map(|x| {
             format!(
-                " references \"{}\"(\"{}\")",
+                " references \"{}\"(\"{}\") ON DELETE CASCADE",
                 x.foreign_table_name(),
                 x.foreign_column_name()
             )