1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.RefactorDeactivatedUserField do
9 # Flip the values before we change the meaning of the column
10 execute("UPDATE users SET deactivated = NOT deactivated;")
11 execute("ALTER TABLE users RENAME COLUMN deactivated TO is_active;")
12 execute("ALTER TABLE users ALTER COLUMN is_active SET DEFAULT true;")
13 execute("ALTER INDEX users_deactivated_index RENAME TO users_is_active_index;")
17 execute("UPDATE users SET is_active = NOT is_active;")
18 execute("ALTER TABLE users RENAME COLUMN is_active TO deactivated;")
19 execute("ALTER TABLE users ALTER COLUMN deactivated SET DEFAULT false;")
20 execute("ALTER INDEX users_is_active_index RENAME TO users_deactivated_index;")