Merge branch 'feature/comments' into 'master'

Comments

See merge request framasoft/mobilizon!335
This commit is contained in:
Thomas Citharel
2019-11-28 12:49:43 +01:00
71 changed files with 2642 additions and 879 deletions

View File

@@ -19,8 +19,8 @@ defmodule Mobilizon.Repo.Migrations.FixCommentsReferences do
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))
modify(:in_reply_to_comment_id, references(:comments, on_delete: :nothing))
modify(:origin_comment_id, references(:comments, on_delete: :delete_all))
end
end
end

View File

@@ -0,0 +1,23 @@
defmodule Mobilizon.Storage.Repo.Migrations.CascadeCommentDeletion do
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: :nilify_all))
modify(:origin_comment_id, references(:comments, on_delete: :nilify_all))
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: :nothing))
end
end
end

View File

@@ -0,0 +1,21 @@
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

View File

@@ -0,0 +1,19 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddLocalFieldToReports do
use Ecto.Migration
def up do
alter table(:reports) do
add(:local, :boolean, default: true, null: false)
end
rename(table(:reports), :uri, to: :url)
end
def down do
alter table(:reports) do
remove(:local)
end
rename(table(:reports), :url, to: :uri)
end
end

View File

@@ -0,0 +1,14 @@
defmodule Mobilizon.Repo.Migrations.CreateTombstones do
use Ecto.Migration
def change do
create table(:tombstones) do
add(:uri, :string)
add(:actor_id, references(:actors, on_delete: :delete_all))
timestamps()
end
create(unique_index(:tombstones, [:uri]))
end
end