pleroma/priv/repo/migrations/20230618190919_create_domains.exs
marcin mikołajczak cee4e2b6a1 Cache domains list
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-11-28 00:22:47 +01:00

24 lines
623 B
Elixir

defmodule Pleroma.Repo.Migrations.CreateDomains do
use Ecto.Migration
def change do
create_if_not_exists table(:domains) do
add(:domain, :citext)
add(:service_domain, :citext)
add(:public, :boolean)
add(:resolves, :boolean)
add(:last_checked_at, :naive_datetime)
timestamps(type: :utc_datetime)
end
create_if_not_exists(unique_index(:domains, [:domain]))
create_if_not_exists(unique_index(:domains, [:service_domain]))
alter table(:users) do
add(:domain_id, references(:domains))
end
create_if_not_exists(index(:users, [:domain_id]))
end
end