Skip to content

Commit 7a9c1fd

Browse files
author
Leo B
committed
Change for readability; allow testing has_one w/composite PKs
1 parent a65997e commit 7a9c1fd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

integration_test/support/migration.exs

+7-7
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,24 @@ defmodule Ecto.Integration.Migration do
116116
end
117117

118118
create table(:composite_pk_composite_pk, primary_key: false) do
119-
add :b_1, :integer
120119
add :a_1, references(:composite_pk, column: :a, with: [b_1: :b], type: :integer)
121-
add :b_2, :integer
120+
add :b_1, :integer
122121
add :a_2, references(:composite_pk, column: :a, with: [b_2: :b], type: :integer)
122+
add :b_2, :integer
123123
end
124124

125125

126126
alter table(:posts) do
127127
modify :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
128128
end
129129

130-
create table(:posts_composite_pk) do
131-
add :post_id, references(:posts), primary_key: true
132-
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer), primary_key: true
133-
add :composite_b, :integer, primary_key: true
130+
create table(:one_to_one_composite_pk) do
131+
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
132+
add :composite_b, :integer
133+
timestamps()
134134
end
135135

136-
create unique_index(:posts_composite_pk, [:post_id, :composite_a, :composite_b])
136+
create unique_index(:one_to_one_composite_pk, [:composite_a, :composite_b])
137137

138138
create table(:corrupted_pk, primary_key: false) do
139139
add :a, :string

0 commit comments

Comments
 (0)