diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-10-13 14:29:34 -0500 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2021-01-15 12:44:41 -0600 |
commit | d36182c08892723b53e801a564531ee7a463052f (patch) | |
tree | 003bbcd561429939be7d7bca92110005aee4e5f6 /priv | |
parent | cf367fdbd53b50f4324a01ddabdc0520cd787321 (diff) |
Change user.confirmation_pending field to user.is_confirmed
Diffstat (limited to 'priv')
-rw-r--r-- | priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs b/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs new file mode 100644 index 000000000..d0dc42827 --- /dev/null +++ b/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs @@ -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.RefactorConfirmationPendingUserField do + use Ecto.Migration + + def up do + # Flip the values before we change the meaning of the column + execute("UPDATE users SET confirmation_pending = NOT confirmation_pending;") + execute("ALTER TABLE users RENAME COLUMN confirmation_pending TO is_confirmed;") + execute("ALTER TABLE users ALTER COLUMN is_confirmed SET DEFAULT true;") + end + + def down do + execute("UPDATE users SET is_confirmed = NOT is_confirmed;") + execute("ALTER TABLE users RENAME COLUMN is_confirmed TO confirmation_pending;") + execute("ALTER TABLE users ALTER COLUMN confirmation_pending SET DEFAULT false;") + end +end |