Change user.approval_pending field to user.is_approved
This commit is contained in:
parent
cf367fdbd5
commit
f7e59c28ed
10 changed files with 74 additions and 54 deletions
|
|
@ -0,0 +1,20 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.RefactorApprovalPendingUserField do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
# Flip the values before we change the meaning of the column
|
||||
execute("UPDATE users SET approval_pending = NOT approval_pending;")
|
||||
execute("ALTER TABLE users RENAME COLUMN approval_pending TO is_approved;")
|
||||
execute("ALTER TABLE users ALTER COLUMN is_approved SET DEFAULT true;")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("UPDATE users SET is_approved = NOT is_approved;")
|
||||
execute("ALTER TABLE users RENAME COLUMN is_approved TO approval_pending;")
|
||||
execute("ALTER TABLE users ALTER COLUMN approval_pending SET DEFAULT false;")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue