mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-11 03:28:01 +01:00
41 lines
1.1 KiB
Elixir
41 lines
1.1 KiB
Elixir
defmodule Philomena.Repo.Migrations.AddApprovalQueue do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
alter table("reports") do
|
|
add :system, :boolean, default: false
|
|
end
|
|
|
|
alter table("images") do
|
|
add :approved, :boolean, default: false
|
|
end
|
|
|
|
alter table("comments") do
|
|
add :approved, :boolean, default: false
|
|
end
|
|
|
|
alter table("posts") do
|
|
add :approved, :boolean, default: false
|
|
end
|
|
|
|
alter table("messages") do
|
|
add :approved, :boolean, default: false
|
|
end
|
|
|
|
alter table("users") do
|
|
add :verified, :boolean, default: false
|
|
end
|
|
|
|
create index(:images, [:hidden_from_users, :approved],
|
|
where: "hidden_from_users = false and approved = false"
|
|
)
|
|
|
|
create index(:reports, [:system], where: "system = true")
|
|
|
|
execute("update images set approved = true;")
|
|
execute("update posts set approved = true;")
|
|
execute("update comments set approved = true;")
|
|
execute("update messages set approved = true;")
|
|
execute("update users set verified = true where created_at < '2022-03-01';")
|
|
end
|
|
end
|