Merge "Increase size of nodes.driver column"

This commit is contained in:
Jenkins 2015-08-20 11:07:03 +00:00 committed by Gerrit Code Review
commit 02583c7573
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,36 @@
# 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.
"""Resizing column nodes.driver
Revision ID: 516faf1bb9b1
Revises: 789acc877671
Create Date: 2015-08-05 13:27:31.808919
"""
# revision identifiers, used by Alembic.
revision = '516faf1bb9b1'
down_revision = '789acc877671'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('nodes', 'driver',
existing_type=sa.String(length=15),
type_=sa.String(length=255))
def downgrade():
pass

View File

@ -158,7 +158,7 @@ class Node(Base):
last_error = Column(Text, nullable=True)
instance_info = Column(JSONEncodedDict)
properties = Column(JSONEncodedDict)
driver = Column(String(15))
driver = Column(String(255))
driver_info = Column(JSONEncodedDict)
driver_internal_info = Column(JSONEncodedDict)
clean_step = Column(JSONEncodedDict)

View File

@ -384,6 +384,15 @@ class MigrationCheckersMixin(object):
node = nodes.select(nodes.c.uuid == uuid).execute().first()
self.assertEqual(bigstring, node['name'])
def _check_516faf1bb9b1(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
bigstring = 'a' * 255
uuid = uuidutils.generate_uuid()
data = {'uuid': uuid, 'driver': bigstring}
nodes.insert().execute(data)
node = nodes.select(nodes.c.uuid == uuid).execute().first()
self.assertEqual(bigstring, node['driver'])
def test_upgrade_and_version(self):
with patch_with_engine(self.engine):
self.migration_api.upgrade('head')