Fluent によって生成される DDL は、多対多の関係 (つまり、ジャンクション / リンク / ブリッジ テーブル) のテーブルを構成する 2 つの列の PK を作成しないことに気付きました。
たとえば (Fluent ソースの Example.FirstProject から)、
Store <-- many-to-many --> Product
StoreProduct テーブルには、次の 2 つの列があります。
ProductFK, StoreFK
この StoreProduct テーブルは、Fluent の HasManyToMany ステートメントによって暗黙的に生成されます。2つの列をPKとして定義するDDLを生成したいと思います。
これは、Fluent for SQLite によって生成されるものです。
create table StoreProduct
(ProductFK INT not null,
StoreFK INT not null,
constraint FKE9A26716DC700501 foreign key (StoreFK) references "Store",
constraint FKE9A26716815A48A8 foreign key (ProductFK) references "Product");
私はこれをしたい:
create table StoreProduct
(ProductFK INT not null,
StoreFK INT not null,
constraint FKE9A26716DC700501 foreign key (StoreFK) references "Store",
constraint FKE9A26716815A48A8 foreign key (ProductFK) references "Product",
PRIMARY KEY(ProductFK, StoreFK));
Fluent でそれは可能ですか (つまり、流暢に指定して、StoreProduct ブリッジ テーブルに ProductFK と StoreFK の両方の PK を持たせる)?