Skip to content

Commit f4248e9

Browse files
author
Leo B
committed
Change for readability; allow testing has_one w/composite PKs
1 parent 34a5e05 commit f4248e9

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
@@ -111,24 +111,24 @@ defmodule Ecto.Integration.Migration do
111111
end
112112

113113
create table(:composite_pk_composite_pk, primary_key: false) do
114-
add :b_1, :integer
115114
add :a_1, references(:composite_pk, column: :a, with: [b_1: :b], type: :integer)
116-
add :b_2, :integer
115+
add :b_1, :integer
117116
add :a_2, references(:composite_pk, column: :a, with: [b_2: :b], type: :integer)
117+
add :b_2, :integer
118118
end
119119

120120

121121
alter table(:posts) do
122122
modify :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
123123
end
124124

125-
create table(:posts_composite_pk) do
126-
add :post_id, references(:posts), primary_key: true
127-
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer), primary_key: true
128-
add :composite_b, :integer, primary_key: true
125+
create table(:one_to_one_composite_pk) do
126+
add :composite_a, references(:composite_pk, column: :a, with: [composite_b: :b], type: :integer)
127+
add :composite_b, :integer
128+
timestamps()
129129
end
130130

131-
create unique_index(:posts_composite_pk, [:post_id, :composite_a, :composite_b])
131+
create unique_index(:one_to_one_composite_pk, [:composite_a, :composite_b])
132132

133133
create table(:corrupted_pk, primary_key: false) do
134134
add :a, :string

0 commit comments

Comments
 (0)