Skip to content

Commit

Permalink
Change for readability; allow testing has_one w/composite PKs
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo B committed Apr 6, 2022
1 parent 53a3395 commit 4481401
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions integration_test/support/migration.exs
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,24 @@ defmodule Ecto.Integration.Migration do
end

create table(:composite_pk_composite_pk, primary_key: false) do
add :b_1, :integer
add :a_1, references(:composite_pk, column: :a, with: [b_1: :b], type: :integer)
add :b_2, :integer
add :b_1, :integer
add :a_2, references(:composite_pk, column: :a, with: [b_2: :b], type: :integer)
add :b_2, :integer
end


alter table(:posts) 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
create table(:one_to_one_composite_pk) do
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
add :composite_b, :integer
timestamps()
end

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

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

0 comments on commit 4481401

Please sign in to comment.