2023-11-06 15:07:18 -08:00
|
|
|
defmodule Pleroma.Repo.Migrations.CreateDomains do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create_if_not_exists table(:domains) do
|
2023-11-09 15:53:17 -08:00
|
|
|
add(:domain, :citext)
|
2023-11-06 15:07:18 -08:00
|
|
|
add(:public, :boolean)
|
2023-11-14 04:51:55 -08:00
|
|
|
add(:resolves, :boolean)
|
|
|
|
add(:last_checked_at, :naive_datetime)
|
2023-11-06 15:07:18 -08:00
|
|
|
|
2023-11-14 04:55:28 -08:00
|
|
|
timestamps(type: :utc_datetime)
|
2023-11-06 15:07:18 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
create_if_not_exists(unique_index(:domains, [:domain]))
|
|
|
|
|
|
|
|
alter table(:users) do
|
|
|
|
add(:domain_id, references(:domains))
|
|
|
|
end
|
2023-11-15 16:18:09 -08:00
|
|
|
|
|
|
|
create_if_not_exists(index(:users, [:domain_id]))
|
2023-11-06 15:07:18 -08:00
|
|
|
end
|
|
|
|
end
|