From 90712c28aef81f9441ce18b089cd9e880a8802ce Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Wed, 15 Mar 2017 13:50:41 +0000 Subject: [PATCH] Increase project and project group name length limitation This patch increase it to 100 chars instead of 50. Change-Id: I0613c0f15a3d8807627676c3392ed29ca6a24685 --- storyboard/api/v1/validations.py | 4 +- ...extends_project_name_and_project_group_.py | 40 +++++++++++++++++++ storyboard/db/models.py | 4 +- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 storyboard/db/migration/alembic_migrations/versions/061_extends_project_name_and_project_group_.py diff --git a/storyboard/api/v1/validations.py b/storyboard/api/v1/validations.py index 26b0c5ca..14da1003 100644 --- a/storyboard/api/v1/validations.py +++ b/storyboard/api/v1/validations.py @@ -99,7 +99,7 @@ PROJECTS_PUT_SCHEMA = { "name": { "type": "string", "minLength": CommonLength.lower_large_length, - "maxLength": CommonLength.top_short_length + "maxLength": CommonLength.top_middle_length }, "repo_url": { "type": ["string", "null"], @@ -118,7 +118,7 @@ PROJECT_GROUPS_PUT_SCHEMA = { "name": { "type": "string", "minLength": CommonLength.lower_large_length, - "maxLength": CommonLength.top_short_length + "maxLength": CommonLength.top_middle_length }, "title": { "type": "string", diff --git a/storyboard/db/migration/alembic_migrations/versions/061_extends_project_name_and_project_group_.py b/storyboard/db/migration/alembic_migrations/versions/061_extends_project_name_and_project_group_.py new file mode 100644 index 00000000..e84bd03c --- /dev/null +++ b/storyboard/db/migration/alembic_migrations/versions/061_extends_project_name_and_project_group_.py @@ -0,0 +1,40 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +"""extends project name and project group name length to 100 + +Revision ID: 061 +Revises: 060 +Create Date: 2017-03-17 10:28:24.567704 + +""" + +# revision identifiers, used by Alembic. +revision = '061' +down_revision = '060' + + +from alembic import op +import sqlalchemy as sa + + +def upgrade(active_plugins=None, options=None): + + op.alter_column('project_groups', 'name', type_=sa.Unicode(100)) + op.alter_column('projects', 'name', type_=sa.Unicode(100)) + + +def downgrade(active_plugins=None, options=None): + + op.alter_column('project_groups', 'name', type_=sa.Unicode(50)) + op.alter_column('projects', 'name', type_=sa.Unicode(50)) diff --git a/storyboard/db/models.py b/storyboard/db/models.py index 3b5085c8..385483fb 100644 --- a/storyboard/db/models.py +++ b/storyboard/db/models.py @@ -264,7 +264,7 @@ class Project(FullText, ModelBuilder, Base): __fulltext_columns__ = ['name', 'description'] - name = Column(String(CommonLength.top_short_length)) + name = Column(String(CommonLength.top_middle_length)) description = Column(UnicodeText()) team_id = Column(Integer, ForeignKey('teams.id')) team = relationship(Team, primaryjoin=team_id == Team.id) @@ -286,7 +286,7 @@ class ProjectGroup(ModelBuilder, Base): schema.UniqueConstraint('name', name='uniq_group_name'), ) - name = Column(String(CommonLength.top_short_length)) + name = Column(String(CommonLength.top_middle_length)) title = Column(Unicode(CommonLength.top_large_length)) projects = relationship("Project", secondary="project_group_mapping")