1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-23 00:14:48 +00:00
mobilizon/priv/repo/migrations/20181108165151_fix_comments_references.exs

27 lines
884 B
Elixir
Raw Normal View History

defmodule Mobilizon.Repo.Migrations.FixCommentsReferences do
@moduledoc """
For some reason these fields references were all wrong.
"""
use Ecto.Migration
def up do
drop(constraint(:comments, "comments_in_reply_to_comment_id_fkey"))
drop(constraint(:comments, "comments_origin_comment_id_fkey"))
alter table(:comments) do
modify(:in_reply_to_comment_id, references(:comments, on_delete: :nothing))
modify(:origin_comment_id, references(:comments, on_delete: :nothing))
end
end
def down do
drop(constraint(:comments, "comments_in_reply_to_comment_id_fkey"))
drop(constraint(:comments, "comments_origin_comment_id_fkey"))
alter table(:comments) do
modify(:in_reply_to_comment_id, references(:comments, on_delete: :nothing))
modify(:origin_comment_id, references(:comments, on_delete: :delete_all))
end
end
end