🐛 — Fix todo enum in jobs table

This commit is contained in:
Luc Didry 2025-02-18 14:22:12 +01:00
parent 09674f73ef
commit d8f30ebccd
No known key found for this signature in database
GPG key ID: EA868E12D0257E3C
3 changed files with 6 additions and 9 deletions

View file

@ -2,6 +2,8 @@
## [Unreleased]
- 🐛 — Fix todo enum in jobs table
## 0.8.0
Date: 2025-02-18

View file

@ -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)

View file

@ -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)