fixing bug changing database model

This commit is contained in:
Cayo Puigdefabregas 2021-05-12 13:02:36 +02:00
parent 5b6073de7e
commit c7ff58273f
3 changed files with 32 additions and 2 deletions

View file

@ -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()}')

View file

@ -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.

View file

@ -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)