Skip to content

Commit

Permalink
Add an associative entity with a composite foreign key
Browse files Browse the repository at this point in the history
  • Loading branch information
soundmonster committed May 18, 2021
1 parent d2dc39b commit fa74cab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions integration_test/support/migration.exs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ defmodule Ecto.Integration.Migration do
modify :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
end

create table(:posts_composite_pk) do
add :post_id, references(:posts), primary_key: true
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer), primary_key: true
add :composite_b, :integer, primary_key: true
end

create unique_index(:posts_composite_pk, [:post_id, :composite_a, :composite_b])

create table(:corrupted_pk, primary_key: false) do
add :a, :string
end
Expand Down

0 comments on commit fa74cab

Please sign in to comment.