소스 검색

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

Kestrel 2 년 전
부모
커밋
27789c8c78
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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()
             )