-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ore_postgres_database/migration/versions/5e27063c3ac9_set_privacy_hide_email_to_false_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""set privacy_hide_email to false temporarily | ||
Revision ID: 5e27063c3ac9 | ||
Revises: 4d007819e61a | ||
Create Date: 2024-12-10 15:50:48.024204+00:00 | ||
""" | ||
from alembic import op | ||
from sqlalchemy.sql import expression | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5e27063c3ac9" | ||
down_revision = "4d007819e61a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Change the server_default of privacy_hide_email to false | ||
with op.batch_alter_table("users") as batch_op: | ||
batch_op.alter_column("privacy_hide_email", server_default=expression.false()) | ||
|
||
# Reset all to default: Update existing values in the database | ||
op.execute("UPDATE users SET privacy_hide_email = false") | ||
|
||
|
||
def downgrade(): | ||
|
||
# Revert the server_default of privacy_hide_email to true | ||
with op.batch_alter_table("users") as batch_op: | ||
batch_op.alter_column("privacy_hide_email", server_default=expression.true()) | ||
|
||
# Reset all to default: Revert existing values in the database to true | ||
op.execute("UPDATE users SET privacy_hide_email = true") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters