Skip to content

Commit 2dbb852

Browse files
committed
Add an associative entity with a composite foreign key
1 parent 3844909 commit 2dbb852

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

integration_test/support/migration.exs

+8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ defmodule Ecto.Integration.Migration do
115115
modify :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
116116
end
117117

118+
create table(:posts_composite_pk) do
119+
add :post_id, references(:posts), primary_key: true
120+
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer), primary_key: true
121+
add :composite_b, :integer, primary_key: true
122+
end
123+
124+
create unique_index(:posts_composite_pk, [:post_id, :composite_a, :composite_b])
125+
118126
create table(:corrupted_pk, primary_key: false) do
119127
add :a, :string
120128
end

0 commit comments

Comments
 (0)