From c7ff58273f8dd9d992439170d69c862f38f257a1 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 12 May 2021 13:02:36 +0200 Subject: [PATCH] fixing bug changing database model --- ...398826453b39_change_command_timeout_of_.py | 30 +++++++++++++++++++ .../8d34480c82c4_add_code_device_search.py | 2 +- ereuse_devicehub/resources/action/models.py | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 ereuse_devicehub/migrations/versions/398826453b39_change_command_timeout_of_.py diff --git a/ereuse_devicehub/migrations/versions/398826453b39_change_command_timeout_of_.py b/ereuse_devicehub/migrations/versions/398826453b39_change_command_timeout_of_.py new file mode 100644 index 00000000..b55d91d1 --- /dev/null +++ b/ereuse_devicehub/migrations/versions/398826453b39_change_command_timeout_of_.py @@ -0,0 +1,30 @@ +"""change command_timeout of TestDataStorage Action + +Revision ID: 398826453b39 +Revises: 8d34480c82c4 +Create Date: 2021-05-12 12:41:02.808311 + +""" +from alembic import op, context +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '398826453b39' +down_revision = '8d34480c82c4' +branch_labels = None +depends_on = None + + +def get_inv(): + INV = context.get_x_argument(as_dictionary=True).get('inventory') + if not INV: + raise ValueError("Inventory value is not specified") + return INV + +def upgrade(): + op.alter_column('test_data_storage', 'command_timeout', type_=sa.BigInteger(), schema=f'{get_inv()}') + + +def downgrade(): + op.alter_column('test_data_storage', 'command_timeout', type_=sa.Integer(), schema=f'{get_inv()}') diff --git a/ereuse_devicehub/migrations/versions/8d34480c82c4_add_code_device_search.py b/ereuse_devicehub/migrations/versions/8d34480c82c4_add_code_device_search.py index fbc5e3b0..8c419f0a 100644 --- a/ereuse_devicehub/migrations/versions/8d34480c82c4_add_code_device_search.py +++ b/ereuse_devicehub/migrations/versions/8d34480c82c4_add_code_device_search.py @@ -10,7 +10,7 @@ from alembic import context import sqlalchemy as sa from sqlalchemy.dialects import postgresql -from ereuse_devicehub.resources.device.search import DeviceSearch +# from ereuse_devicehub.resources.device.search import DeviceSearch # revision identifiers, used by Alembic. diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 1211825b..01edae95 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -742,7 +742,7 @@ class TestDataStorage(TestMixin, Test): reallocated_sector_count = Column(SmallInteger) power_cycle_count = Column(SmallInteger) _reported_uncorrectable_errors = Column('reported_uncorrectable_errors', Integer) - command_timeout = Column(Integer) + command_timeout = Column(BigInteger) current_pending_sector_count = Column(Integer) offline_uncorrectable = Column(Integer) remaining_lifetime_percentage = Column(SmallInteger)