From fa74cab75cd55d197339619dc5b4f5908d26dcf8 Mon Sep 17 00:00:00 2001 From: Leo Batyuk Date: Tue, 18 May 2021 17:28:01 +0200 Subject: [PATCH] Add an associative entity with a composite foreign key --- integration_test/support/migration.exs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/integration_test/support/migration.exs b/integration_test/support/migration.exs index 4abda151..868266a4 100644 --- a/integration_test/support/migration.exs +++ b/integration_test/support/migration.exs @@ -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