Increase length of 'name' column in package table

Cherry-picked from master

When using mysql, we need to make sure that the
name column is long enough to accomodate the
package name.

'io.murano.lib.networks.Neutron' is more than
20 chars.  Modify the schema to make it 80 chars

Change-Id: I6f7154141ad4b728d98f436b2eaa839239ee302a
Closes-Bug: #1314389
This commit is contained in:
Ankur Rishi 2014-04-29 13:53:34 -07:00 committed by Ekaterina Fedorova
parent 5ca0471047
commit 05bd34d25b
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,30 @@
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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.
from sqlalchemy import schema
from sqlalchemy import types
meta = schema.MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
table = schema.Table('package', meta, autoload=True)
table.c.name.alter(type=types.String(80))
def downgrade(migrate_engine):
meta.bind = migrate_engine
table = schema.Table('package', meta, autoload=True)
table.c.name.alter(type=types.String(20))

View File

@ -270,7 +270,7 @@ class Package(BASE, ModificationsTrackedObject):
unique=True)
type = sa.Column(sa.String(20), nullable=False, default='class')
author = sa.Column(sa.String(80), default='Openstack')
name = sa.Column(sa.String(20), nullable=False)
name = sa.Column(sa.String(80), nullable=False)
enabled = sa.Column(sa.Boolean, default=True)
description = sa.Column(sa.String(512),
nullable=False,