mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2025-01-30 13:31:13 +00:00
Fix comments table references
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
20e47add28
commit
69c24b8b25
1 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
|||
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(:categories, on_delete: :nothing)
|
||||
modify :origin_comment_id, references(:addresses, on_delete: :delete_all)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue