This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/migrations/versions/378b6b147b46_nullable.py

42 lines
1.2 KiB
Python
Raw Normal View History

2020-12-16 10:57:51 +00:00
"""empty message
Revision ID: 378b6b147b46
Revises: bf600ca861a4
Create Date: 2020-12-16 11:45:13.339624
"""
2023-03-21 16:31:43 +00:00
import citext
2020-12-16 10:57:51 +00:00
import sqlalchemy as sa
import sqlalchemy_utils
2023-03-21 16:31:43 +00:00
from alembic import context
from alembic import op
from ereuse_devicehub import teal
2020-12-16 10:57:51 +00:00
# revision identifiers, used by Alembic.
revision = '378b6b147b46'
down_revision = 'bf600ca861a4'
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():
2020-12-16 11:06:19 +00:00
op.alter_column('computer', 'chassis', nullable=True, schema=f'{get_inv()}')
op.alter_column('display', 'size', nullable=True, schema=f'{get_inv()}')
op.alter_column('display', 'resolution_width', nullable=True, schema=f'{get_inv()}')
op.alter_column('display', 'resolution_height', nullable=True, schema=f'{get_inv()}')
2020-12-17 14:09:21 +00:00
op.alter_column('monitor', 'size', nullable=True, schema=f'{get_inv()}')
op.alter_column('monitor', 'resolution_width', nullable=True, schema=f'{get_inv()}')
op.alter_column('monitor', 'resolution_height', nullable=True, schema=f'{get_inv()}')
2020-12-16 10:57:51 +00:00
# pass
def downgrade():
pass