Modify the length of project_id for Messages
Length of 'project_id' in Messages should be 255, similar to other ORM models. Modified the project_id legnth to 255 from 36. Change-Id: I3b4e14bcf490046ec2251de4ca95571f439ca0eb Closes-Bug: 1691060
This commit is contained in:
parent
30431abf2a
commit
5b9ae3cde8
@ -0,0 +1,21 @@
|
||||
# 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 MetaData, String, Table
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
|
||||
messages = Table('messages', meta, autoload=True)
|
||||
messages.c.project_id.alter(type=String(255))
|
@ -813,7 +813,7 @@ class Message(BASE, CinderBase):
|
||||
"""Represents a message"""
|
||||
__tablename__ = 'messages'
|
||||
id = Column(String(36), primary_key=True, nullable=False)
|
||||
project_id = Column(String(36), nullable=False)
|
||||
project_id = Column(String(255), nullable=False)
|
||||
# Info/Error/Warning.
|
||||
message_level = Column(String(255), nullable=False)
|
||||
request_id = Column(String(255), nullable=True)
|
||||
|
@ -120,6 +120,9 @@ class MigrationsMixin(test_migrations.WalkVersionsMixin):
|
||||
# NOTE(ameade): 87 sets messages.request_id to nullable. This
|
||||
# should be safe for the same reason as migration 66.
|
||||
87,
|
||||
# NOTE : 104 modifies size of messages.project_id to 255.
|
||||
# This should be safe for the same reason as migration 87.
|
||||
104,
|
||||
]
|
||||
|
||||
# NOTE(dulek): We only started requiring things be additive in
|
||||
@ -1254,6 +1257,10 @@ class MigrationsMixin(test_migrations.WalkVersionsMixin):
|
||||
self.assertIsInstance(attachment.c.action_id.type,
|
||||
self.VARCHAR_TYPE)
|
||||
|
||||
def _check_104(self, engine, data):
|
||||
messages = db_utils.get_table(engine, 'messages')
|
||||
self.assertEqual(255, messages.c.project_id.type.length)
|
||||
|
||||
def test_walk_versions(self):
|
||||
self.walk_versions(False, False)
|
||||
self.assert_each_foreign_key_is_part_of_an_index()
|
||||
|
Loading…
x
Reference in New Issue
Block a user