Merge "Fix data length exceeding limit error"
This commit is contained in:
commit
5c00b7cf0b
@ -0,0 +1,33 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
"""increase-length-of-user-column
|
||||||
|
|
||||||
|
Revision ID: 01f21d5e5195
|
||||||
|
Revises: aa2384fee727
|
||||||
|
Create Date: 2024-03-05 11:02:08.996894
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '01f21d5e5195'
|
||||||
|
down_revision = 'aa2384fee727'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column('node_history', 'user',
|
||||||
|
existing_type=sa.String(length=32),
|
||||||
|
type_=sa.String(length=64),
|
||||||
|
existing_nullable=True)
|
@ -484,7 +484,7 @@ class NodeHistory(Base):
|
|||||||
event_type = Column(String(255), nullable=True)
|
event_type = Column(String(255), nullable=True)
|
||||||
severity = Column(String(255), nullable=True)
|
severity = Column(String(255), nullable=True)
|
||||||
event = Column(Text, nullable=True)
|
event = Column(Text, nullable=True)
|
||||||
user = Column(String(32), nullable=True)
|
user = Column(String(64), nullable=True)
|
||||||
node_id = Column(Integer, ForeignKey('nodes.id'), nullable=True)
|
node_id = Column(Integer, ForeignKey('nodes.id'), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,6 +351,22 @@ class MigrationCheckersMixin(object):
|
|||||||
self.assertIsInstance(nodes.c.inspection_finished_at.type,
|
self.assertIsInstance(nodes.c.inspection_finished_at.type,
|
||||||
sqlalchemy.types.DateTime)
|
sqlalchemy.types.DateTime)
|
||||||
|
|
||||||
|
def _check_01f21d5e5195(self, engine, data):
|
||||||
|
node_history = db_utils.get_table(engine, 'node_history')
|
||||||
|
bigstring = 'a' * 64
|
||||||
|
uuid = uuidutils.generate_uuid()
|
||||||
|
data = {'uuid': uuid, 'user': bigstring}
|
||||||
|
with engine.begin() as connection:
|
||||||
|
insert_node_history = node_history.insert().values(data)
|
||||||
|
connection.execute(insert_node_history)
|
||||||
|
node_history_stmt = sqlalchemy.select(
|
||||||
|
models.NodeHistory.user
|
||||||
|
).where(
|
||||||
|
models.NodeHistory.uuid == uuid
|
||||||
|
)
|
||||||
|
node_history = connection.execute(node_history_stmt).first()
|
||||||
|
self.assertEqual(bigstring, node_history.user)
|
||||||
|
|
||||||
def _check_4f399b21ae71(self, engine, data):
|
def _check_4f399b21ae71(self, engine, data):
|
||||||
nodes = db_utils.get_table(engine, 'nodes')
|
nodes = db_utils.get_table(engine, 'nodes')
|
||||||
col_names = [column.name for column in nodes.c]
|
col_names = [column.name for column in nodes.c]
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Increases the 32-character limit of the ``user`` column in the
|
||||||
|
``NodeHistory`` model to support up to 64-character-long values.
|
||||||
|
For more information, `see bug <https://bugs.launchpad.net/ironic/+bug/2054594>`_.
|
Loading…
Reference in New Issue
Block a user