feat: allow users to hide deleted comments

Closes: #435

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
Leonidas Spyropoulos 2023-04-21 19:47:55 +01:00
parent 174af5f025
commit 6ede837b4f
No known key found for this signature in database
GPG key ID: 59E43E106B247368
9 changed files with 132 additions and 5 deletions

View file

@ -0,0 +1,33 @@
"""Add HideDeletedComments to User
Revision ID: e4e49ffce091
Revises: 9e3158957fd7
Create Date: 2023-04-19 23:24:25.854874
"""
from alembic import op
from sqlalchemy.exc import OperationalError
from aurweb.models.user import User
# revision identifiers, used by Alembic.
revision = "e4e49ffce091"
down_revision = "9e3158957fd7"
branch_labels = None
depends_on = None
table = User.__table__
def upgrade():
try:
op.add_column(table.name, table.c.HideDeletedComments)
except OperationalError:
print(
f"Column HideDeletedComments already exists in '{table.name}',"
f" skipping migration."
)
def downgrade():
op.drop_column(table.name, "HideDeletedComments")