Browse Source

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

Kestrel 2 years ago
parent
commit
27789c8c78
1 changed files with 1 additions and 1 deletions
  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()
             )