debianize-mobilizon/priv/repo/migrations/20191122154018_add_deleted_at_on_comments.exs

22 lines
588 B
Elixir
Raw Normal View History

defmodule Mobilizon.Storage.Repo.Migrations.AddDeletedAtOnComments do
use Ecto.Migration
def up do
drop_if_exists(constraint(:comments, "comments_actor_id_fkey"))
alter table(:comments) do
add(:deleted_at, :utc_datetime, null: true)
modify(:actor_id, references(:actors, on_delete: :nilify_all), null: true)
end
end
def down do
drop_if_exists(constraint(:comments, "comments_actor_id_fkey"))
alter table(:comments) do
remove(:deleted_at)
modify(:actor_id, references(:actors, on_delete: :nilify_all), null: false)
end
end
end