From c2701eb63a5fd26cf7f5244a65ec54ce4e5c37c5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 30 2016 15:32:24 +0000 Subject: Make the group_name be of max 255 characters For some reasons we were limiting them to 16 chars, while FAS uses 32 and since pagure does not per say require FAS to work, there is no good reason to use 32 rather than 255, so this commit bumps the limit directly to 255. Fixes https://pagure.io/pagure/issue/1616 --- diff --git a/alembic/versions/349a3890596_increase_length_group_name.py b/alembic/versions/349a3890596_increase_length_group_name.py new file mode 100644 index 0000000..4e84bd5 --- /dev/null +++ b/alembic/versions/349a3890596_increase_length_group_name.py @@ -0,0 +1,34 @@ +"""Increase length group name + +Revision ID: 349a3890596 +Revises: 5083efccac7 +Create Date: 2016-11-30 14:30:15.681269 + +""" + +# revision identifiers, used by Alembic. +revision = '349a3890596' +down_revision = '5083efccac7' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ''' Increase the length of group_name to 255 characters instead of 16. + ''' + op.alter_column( + 'pagure_group', 'group_name', + type_=sa.String(255), + existing_type=sa.String(16) + ) + + +def downgrade(): + ''' Decrease the length of group_name to 16 characters instead of 255. + ''' + op.alter_column( + 'pagure_group', 'group_name', + type_=sa.String(16), + existing_type=sa.String(255) + ) diff --git a/pagure/forms.py b/pagure/forms.py index 3663446..71e6542 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -503,7 +503,7 @@ class NewGroupForm(EditGroupForm): 'Group name *', [ wtforms.validators.Required(), - wtforms.validators.Length(max=16), + wtforms.validators.Length(max=255), wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) diff --git a/pagure/lib/model.py b/pagure/lib/model.py index db1abd2..95a2843 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -1460,7 +1460,7 @@ class PagureGroup(BASE): __tablename__ = 'pagure_group' id = sa.Column(sa.Integer, primary_key=True) - group_name = sa.Column(sa.String(16), nullable=False, unique=True) + group_name = sa.Column(sa.String(255), nullable=False, unique=True) display_name = sa.Column(sa.String(255), nullable=False, unique=True) description = sa.Column(sa.String(255), nullable=True) group_type = sa.Column(