Change user.deactivated field to user.is_active
This commit is contained in:
parent
cf367fdbd5
commit
860b5c7804
40 changed files with 125 additions and 107 deletions
|
|
@ -0,0 +1,18 @@
|
|||
defmodule Pleroma.Repo.Migrations.RefactorDeactivatedUserField do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
# Flip the values before we change the meaning of the column
|
||||
execute("UPDATE users SET deactivated = NOT deactivated;")
|
||||
execute("ALTER TABLE users RENAME COLUMN deactivated TO is_active;")
|
||||
execute("ALTER TABLE users ALTER COLUMN is_active SET DEFAULT true;")
|
||||
execute("ALTER INDEX users_deactivated_index RENAME TO users_is_active_index;")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("UPDATE users SET is_active = NOT is_active;")
|
||||
execute("ALTER TABLE users RENAME COLUMN is_active TO deactivated;")
|
||||
execute("ALTER TABLE users ALTER COLUMN deactivated SET DEFAULT false;")
|
||||
execute("ALTER INDEX users_is_active_index RENAME TO users_deactivated_index;")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue