Explorar o código

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

Kestrel %!s(int64=2) %!d(string=hai) anos
pai
achega
27789c8c78
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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()
             )