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/eca457d8b2a4_change_deliverynote.py
2021-02-03 22:28:04 +01:00

35 lines
793 B
Python

"""change deliverynote
Revision ID: eca457d8b2a4
Revises: 0cbd839b09ef
Create Date: 2021-02-03 22:12:41.033661
"""
from alembic import context
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
import citext
import teal
# revision identifiers, used by Alembic.
revision = 'eca457d8b2a4'
down_revision = '0cbd839b09ef'
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.drop_column('deliverynote', 'ethereum_address', schema=f'{get_inv()}')
def downgrade():
op.add_column('deliverynote', sa.Column('ethereum_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')