Skip to content

Commit d951e49

Browse files
committed
update docs, minor unit test change
1 parent ff60dd3 commit d951e49

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

integration_test/pg/migrations_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ defmodule Ecto.Integration.MigrationsTest do
153153
assert up_log =~ ~s(DROP CONSTRAINT "my_comments_user_id_fkey",)
154154
refute up_log =~ ~s(ALTER COLUMN "user_id" TYPE)
155155
assert up_log =~ ~s/ADD CONSTRAINT "my_comments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "my_users"("id") ON DELETE SET NULL/
156-
assert up_log =~ ~s{ALTER TABLE "my_comments" DROP CONSTRAINT "my_comments_user_id_fkey", ADD CONSTRAINT "my_comments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "my_users"("id") ON DELETE SET NULL}
157156

158157
assert up_log =~ ~s(ALTER TABLE "my_posts")
159158
refute up_log =~ ~s(ALTER COLUMN "user_id" TYPE)

lib/ecto/migration.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,10 +1283,9 @@ defmodule Ecto.Migration do
12831283
> type update can lock the table, even if the type actually
12841284
> doesn't change.
12851285
>
1286-
> We have considered changing the column type even when it is not needed
1287-
> could lead to undesirable locks, that's why, at least in the PostgreSQL
1288-
> adapter, if you provide the option `:from`, and the column type matches,
1289-
> we will skip updating it.
1286+
> These undesired locks can be avoided when using the PostgreSQL adapter by
1287+
> providing the `:from` option and ensuring its type matches the type provided
1288+
> to `modify/3`. In that scenario, the type change part of the migration is omitted.
12901289
>
12911290
> Examples:
12921291
>

0 commit comments

Comments
 (0)