From 89109bd1b4a758c0c16fde4e4efb9275b35706f5 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 12 Jul 2023 14:17:16 +0200 Subject: [PATCH] add migration file --- ...be6847b24846_add_usody_in_enum_software.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 ereuse_devicehub/migrations/versions/be6847b24846_add_usody_in_enum_software.py diff --git a/ereuse_devicehub/migrations/versions/be6847b24846_add_usody_in_enum_software.py b/ereuse_devicehub/migrations/versions/be6847b24846_add_usody_in_enum_software.py new file mode 100644 index 00000000..2cd66d29 --- /dev/null +++ b/ereuse_devicehub/migrations/versions/be6847b24846_add_usody_in_enum_software.py @@ -0,0 +1,30 @@ +"""add usody in enum software + +Revision ID: be6847b24846 +Revises: 5169765e2653 +Create Date: 2023-07-11 14:07:08.887104 + +""" +from alembic import context, op + +# revision identifiers, used by Alembic. +revision = 'be6847b24846' +down_revision = '5169765e2653' +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.execute("ALTER TYPE snapshotsoftware ADD VALUE 'UsodyOS'") + + +def downgrade(): + # "select e.enumlabel FROM pg_enum e JOIN pg_type t ON e.enumtypid = t.oid WHERE t.typname = 'snapshotsoftware'" + pass