mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-29 10:22:37 +02:00
🐛 — Fix todo enum in jobs table
This commit is contained in:
parent
09674f73ef
commit
d8f30ebccd
3 changed files with 6 additions and 9 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- 🐛 — Fix todo enum in jobs table
|
||||||
|
|
||||||
## 0.8.0
|
## 0.8.0
|
||||||
|
|
||||||
Date: 2025-02-18
|
Date: 2025-02-18
|
||||||
|
|
|
@ -19,16 +19,10 @@ depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> 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(
|
op.create_table(
|
||||||
"jobs",
|
"jobs",
|
||||||
sa.Column("id", sa.Integer(), nullable=False),
|
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("args", sa.String(), nullable=False),
|
||||||
sa.Column(
|
sa.Column(
|
||||||
"current", sa.Boolean(), server_default=sa.sql.false(), nullable=False
|
"current", sa.Boolean(), server_default=sa.sql.false(), nullable=False
|
||||||
|
@ -40,4 +34,3 @@ def upgrade() -> None:
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
op.drop_table("jobs")
|
op.drop_table("jobs")
|
||||||
sa.Enum(name="todo_enum").drop(op.get_bind(), checkfirst=True)
|
|
||||||
|
|
|
@ -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).
|
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)
|
||||||
|
|
Loading…
Reference in a new issue