diff --git a/CHANGELOG.md b/CHANGELOG.md index df458cd..91280c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- 🐛 — Fix todo enum in jobs table + ## 0.8.0 Date: 2025-02-18 diff --git a/argos/server/migrations/versions/5f6cb30db996_add_job_queue.py b/argos/server/migrations/versions/5f6cb30db996_add_job_queue.py index cf5d9e2..7c6a6ee 100644 --- a/argos/server/migrations/versions/5f6cb30db996_add_job_queue.py +++ b/argos/server/migrations/versions/5f6cb30db996_add_job_queue.py @@ -19,16 +19,10 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: - enum = sa.Enum( - "RELOAD_CONFIG", - name="todo_enum", - create_type=False, - ) - enum.create(op.get_bind(), checkfirst=True) op.create_table( "jobs", sa.Column("id", sa.Integer(), nullable=False), - sa.Column("todo", enum, nullable=False), + sa.Column("todo", sa.Enum("RELOAD_CONFIG", name="todo_enum"), nullable=False), sa.Column("args", sa.String(), nullable=False), sa.Column( "current", sa.Boolean(), server_default=sa.sql.false(), nullable=False @@ -40,4 +34,3 @@ def upgrade() -> None: def downgrade() -> None: op.drop_table("jobs") - sa.Enum(name="todo_enum").drop(op.get_bind(), checkfirst=True) diff --git a/docs/developer/migrations.md b/docs/developer/migrations.md index 36c9dd9..f79845d 100644 --- a/docs/developer/migrations.md +++ b/docs/developer/migrations.md @@ -16,4 +16,6 @@ venv/bin/alembic -c argos/server/migrations/alembic.ini revision \ Edit the created file to remove comments and adapt it to make sure the migration is complete (Alembic is not powerful enough to cover all the corner cases). -In case you want to add an `Enum` type, please have a look at [argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py](https://framagit.org/framasoft/framaspace/argos/-/blob/main/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py). +In case you want to add an `Enum` type and use it in an existing table, please have a look at [`argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py`](https://framagit.org/framasoft/framaspace/argos/-/blob/main/argos/server/migrations/versions/dcf73fa19fce_specify_check_method.py). + +If you want to add an `Enum` type in a new table, you can do like in [`argos/server/migrations/versions/7d480e6f1112_initial_migrations.py`](https://framagit.org/framasoft/framaspace/argos/-/blob/main/argos/server/migrations/versions/7d480e6f1112_initial_migrations.py)