From e58b08e12c16c97d0c01e068ba9a665f70db2b92 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 3 Mar 2021 20:04:57 +0100 Subject: [PATCH] add code in migrations --- .../versions/8cb91ad1cc40_add_code_to_device.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/8cb91ad1cc40_add_code_to_device.py b/ereuse_devicehub/migrations/versions/8cb91ad1cc40_add_code_to_device.py index bf49f056..44d7c39a 100644 --- a/ereuse_devicehub/migrations/versions/8cb91ad1cc40_add_code_to_device.py +++ b/ereuse_devicehub/migrations/versions/8cb91ad1cc40_add_code_to_device.py @@ -6,10 +6,9 @@ Create Date: 2021-03-03 10:39:19.331027 """ from alembic import op +from alembic import context import sqlalchemy as sa -import sqlalchemy_utils import citext -import teal # revision identifiers, used by Alembic. @@ -25,9 +24,11 @@ def get_inv(): raise ValueError("Inventory value is not specified") return INV + def upgrade(): - pass + op.add_column('device', sa.Column('code', citext.CIText(), + nullable=True), schema=f'{get_inv()}') def downgrade(): - pass + op.drop_column('device', 'code', schema=f'{get_inv()}')