diff --git a/app/models.py b/app/models.py index 18735114..5742db5c 100644 --- a/app/models.py +++ b/app/models.py @@ -2001,7 +2001,7 @@ class CommunityBan(db.Model): user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) # person who is banned, not the banner community_id = db.Column(db.Integer, db.ForeignKey('community.id'), primary_key=True) banned_by = db.Column(db.Integer, db.ForeignKey('user.id')) - reason = db.Column(db.String(50)) + reason = db.Column(db.String(256)) created_at = db.Column(db.DateTime, default=utcnow) ban_until = db.Column(db.DateTime) diff --git a/migrations/versions/7f7dfd4d4f1b_increase_length_of_ban_reason.py b/migrations/versions/7f7dfd4d4f1b_increase_length_of_ban_reason.py new file mode 100644 index 00000000..680fcce0 --- /dev/null +++ b/migrations/versions/7f7dfd4d4f1b_increase_length_of_ban_reason.py @@ -0,0 +1,38 @@ +"""increase length of ban reason + +Revision ID: 7f7dfd4d4f1b +Revises: d2bd6281a8d3 +Create Date: 2024-11-23 18:47:41.698925 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '7f7dfd4d4f1b' +down_revision = 'd2bd6281a8d3' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('community_ban', schema=None) as batch_op: + batch_op.alter_column('reason', + existing_type=sa.VARCHAR(length=50), + type_=sa.String(length=256), + existing_nullable=True) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('community_ban', schema=None) as batch_op: + batch_op.alter_column('reason', + existing_type=sa.String(length=256), + type_=sa.VARCHAR(length=50), + existing_nullable=True) + + # ### end Alembic commands ###