File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1021,6 +1021,23 @@ defmodule Ecto.MigrationTest do
10211021 assert { :create , % Index { } } = last_command ( )
10221022 end
10231023
1024+ test "renames an index" do
1025+ rename index ( :people , [ :name ] ) , to: "person_names_idx"
1026+ flush ( )
1027+ { _ , index , old_name } = last_command ( )
1028+ assert old_name == :people_name_index
1029+ assert is_nil ( index . prefix )
1030+ end
1031+
1032+ @ tag prefix: "foo"
1033+ test "renames an index with a prefix" do
1034+ rename index ( :people , [ :name ] ) , to: "person_names_idx"
1035+ flush ( )
1036+ { _ , index , old_name } = last_command ( )
1037+ assert old_name == :people_name_index
1038+ assert index . prefix == "foo"
1039+ end
1040+
10241041 test "drops a constraint" do
10251042 assert_raise Ecto.MigrationError , ~r/ cannot reverse migration command/ , fn ->
10261043 drop_if_exists constraint ( :posts , :price )
You can’t perform that action at this time.
0 commit comments