diff options
| author | lain <lain@soykaf.club> | 2021-01-26 14:24:32 +0000 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2021-01-26 14:24:32 +0000 |
| commit | 229acae6c3da541ebb0438cb7f310cdce1df92b3 (patch) | |
| tree | 8b93f46ac090021e7e53db392ba54a3c48b31fda /priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs | |
| parent | 71166b30a42ad3a8988049992bcab93c7e2ed656 (diff) | |
| parent | 250e2020987b1fc65251ba9564e41b38ba060391 (diff) | |
| download | pleroma-229acae6c3da541ebb0438cb7f310cdce1df92b3.tar.gz pleroma-229acae6c3da541ebb0438cb7f310cdce1df92b3.zip | |
Merge branch 'develop' into '2435-list-multiple-users'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs')
| -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 |
