From 0f099b9df400cdf199fbf84a426641d5e092d676 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Wed, 29 Jan 2025 11:37:09 +0100 Subject: [PATCH] Fix method enum in tasks table --- .../dcf73fa19fce_specify_check_method.py | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py b/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py index fdfa97c..39cacbe 100644 --- a/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py +++ b/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py @@ -5,6 +5,7 @@ Revises: c780864dc407 Create Date: 2024-11-26 14:40:27.510587 """ + from typing import Sequence, Union from alembic import op @@ -19,22 +20,25 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: + enum = sa.Enum( + "GET", + "HEAD", + "POST", + "OPTIONS", + "CONNECT", + "TRACE", + "PUT", + "PATCH", + "DELETE", + name="method", + create_type=False, + ) + enum.create(op.get_bind(), checkfirst=True) with op.batch_alter_table("tasks", schema=None) as batch_op: batch_op.add_column( sa.Column( "method", - sa.Enum( - "GET", - "HEAD", - "POST", - "OPTIONS", - "CONNECT", - "TRACE", - "PUT", - "PATCH", - "DELETE", - name="method", - ), + enum, nullable=False, server_default="GET", )