Increase project and project group name length limitation

This patch increase it to 100 chars instead of 50.

Change-Id: I0613c0f15a3d8807627676c3392ed29ca6a24685
This commit is contained in:
Fabien Boucher 2017-03-15 13:50:41 +00:00
parent 1297093792
commit 90712c28ae
3 changed files with 44 additions and 4 deletions

View File

@ -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",

View File

@ -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))

View File

@ -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")