2018-12-03 11:58:57 +01:00
|
|
|
defmodule Mobilizon.Repo.Migrations.ChangeActorsIndexes do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
2019-02-22 14:18:52 +01:00
|
|
|
drop(
|
|
|
|
index("actors", [:preferred_username, :domain],
|
|
|
|
name: :actors_preferred_username_domain_index
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
drop(index("actors", [:name, :domain], name: :accounts_username_domain_index))
|
|
|
|
execute("ALTER INDEX accounts_pkey RENAME TO actors_pkey")
|
|
|
|
create(index("actors", [:preferred_username, :domain, :type], unique: true))
|
|
|
|
create(index("actors", [:url], unique: true))
|
2018-12-03 11:58:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
2019-02-22 14:18:52 +01:00
|
|
|
create(
|
|
|
|
index("actors", [:preferred_username, :domain],
|
|
|
|
name: :actors_preferred_username_domain_index
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
create(index("actors", [:name, :domain], name: :accounts_username_domain_index))
|
|
|
|
execute("ALTER INDEX actors_pkey RENAME TO accounts_pkey")
|
|
|
|
drop(index("actors", [:preferred_username, :domain, :type]))
|
|
|
|
drop(index("actors", [:url]))
|
2018-12-03 11:58:57 +01:00
|
|
|
end
|
|
|
|
end
|