Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F12552741
20201012173004_refactor_deactivated_user_field.exs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
942 B
Referenced Files
None
Subscribers
None
20201012173004_refactor_deactivated_user_field.exs
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Nov 15, 1:04 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
632997
Default Alt Text
20201012173004_refactor_deactivated_user_field.exs (942 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment