diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d62eb9..707a25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - 🐛 — Fix bug when changing IP version not removing tasks (#72) - ✨ — Allow to specify form data and headers for checks (#70) - 🚸 — Add a long expiration date on auto-refresh cookies +- 🗃️ — Use bigint type for results id column in PostgreSQL (#73) ## 0.6.1 diff --git a/argos/server/migrations/versions/bd4b4962696a_use_bigint_for_results_id_field.py b/argos/server/migrations/versions/bd4b4962696a_use_bigint_for_results_id_field.py new file mode 100644 index 0000000..766428e --- /dev/null +++ b/argos/server/migrations/versions/bd4b4962696a_use_bigint_for_results_id_field.py @@ -0,0 +1,44 @@ +"""Use bigint for results id field + +Revision ID: bd4b4962696a +Revises: 31255a412d63 +Create Date: 2025-01-06 11:44:37.552965 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = "bd4b4962696a" +down_revision: Union[str, None] = "31255a412d63" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + bind = op.get_bind() + if bind.engine.name != "sqlite": + with op.batch_alter_table("results", schema=None) as batch_op: + batch_op.alter_column( + "id", + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + ) + + +def downgrade() -> None: + bind = op.get_bind() + if bind.engine.name != "sqlite": + with op.batch_alter_table("results", schema=None) as batch_op: + batch_op.alter_column( + "id", + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + )