From 1cf4cd3ee65e2965f56bceebfab23636f57437ab Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 31 Jan 2022 16:02:28 +0800 Subject: [PATCH] Update `create_table_from_entity`'s foreign key name (SeaQL/sea-orm#417) --- SeaORM/docs/04-generate-database-schema/01-create-table.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SeaORM/docs/04-generate-database-schema/01-create-table.md b/SeaORM/docs/04-generate-database-schema/01-create-table.md index 4ac5820dd26..46c5cbbd5d5 100644 --- a/SeaORM/docs/04-generate-database-schema/01-create-table.md +++ b/SeaORM/docs/04-generate-database-schema/01-create-table.md @@ -39,7 +39,7 @@ assert_eq!( ) .foreign_key( ForeignKeyCreateStatement::new() - .name("fk-cake_filling_price-cake_filling") + .name("fk-cake_filling_price-cake_id-filling_id") .from_tbl(CakeFillingPrice) .from_col(cake_filling_price::Column::CakeId) .from_col(cake_filling_price::Column::FillingId) @@ -71,7 +71,7 @@ To further illustrate it, we will show the SQL statement as string below. r#""filling_id" integer NOT NULL,"#, r#""price" decimal NOT NULL,"#, r#"CONSTRAINT "pk-cake_filling_price" PRIMARY KEY ("cake_id", "filling_id"),"#, - r#"CONSTRAINT "fk-cake_filling_price-cake_filling" FOREIGN KEY ("cake_id", "filling_id") REFERENCES "cake_filling" ("cake_id", "filling_id")"#, + r#"CONSTRAINT "fk-cake_filling_price-cake_id-filling_id" FOREIGN KEY ("cake_id", "filling_id") REFERENCES "cake_filling" ("cake_id", "filling_id")"#, r#")"#, ] .join(" ") @@ -96,7 +96,7 @@ To further illustrate it, we will show the SQL statement as string below. "`filling_id` int NOT NULL,", "`price` decimal NOT NULL,", "PRIMARY KEY `pk-cake_filling_price` (`cake_id`, `filling_id`),", - "CONSTRAINT `fk-cake_filling_price-cake_filling` FOREIGN KEY (`cake_id`, `filling_id`) REFERENCES `cake_filling` (`cake_id`, `filling_id`)", + "CONSTRAINT `fk-cake_filling_price-cake_id-filling_id` FOREIGN KEY (`cake_id`, `filling_id`) REFERENCES `cake_filling` (`cake_id`, `filling_id`)", ")", ] .join(" ")