mobilizon/priv/repo/migrations/20211223141104_add_instance_materialized_view.exs
Thomas Citharel 4f530cabcf
fix(reports): remove on delete cascade for reports
Deleting an actor should not remove the reports

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-08-31 19:04:12 +02:00

25 lines
562 B
Elixir

defmodule Mobilizon.Storage.Repo.Migrations.AddInstanceMaterializedView do
use Ecto.Migration
alias Mobilizon.Storage.Views.Instances
def up do
execute(Instances.create_materialized_view())
execute(Instances.refresh_instances())
execute(Instances.drop_trigger())
execute(Instances.create_trigger())
create_if_not_exists(unique_index("instances", [:domain]))
end
def down do
drop_if_exists(unique_index("instances", [:domain]))
execute(Instances.drop_refresh_instances())
execute(Instances.drop_view())
end
end