diff --git a/flask_app/Dockerfile b/flask_app/Dockerfile index f7ac68a..1666e9e 100644 --- a/flask_app/Dockerfile +++ b/flask_app/Dockerfile @@ -15,6 +15,8 @@ RUN pip install --no-cache-dir -r requirements.txt COPY run.py . COPY app ./app +COPY alembic.ini . +COPY alembic ./alembic EXPOSE 3108 diff --git a/flask_app/alembic/versions/0002_tests_hints_result_mode.py b/flask_app/alembic/versions/0002_tests_hints_result_mode.py new file mode 100644 index 0000000..82279bb --- /dev/null +++ b/flask_app/alembic/versions/0002_tests_hints_result_mode.py @@ -0,0 +1,38 @@ +"""Добавление hints_enabled и result_mode в tests. + +Revision ID: 0002_tests_hints_result_mode +Revises: 0001_baseline +Create Date: 2026-04-29 + +Совместимо с БД, где колонки уже есть: используется ADD COLUMN IF NOT EXISTS (PostgreSQL). +""" +from __future__ import annotations + +from typing import Sequence, Union + +from alembic import op + +revision: str = "0002_tests_hints_result_mode" +down_revision: Union[str, None] = "0001_baseline" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.execute( + """ + ALTER TABLE tests + ADD COLUMN IF NOT EXISTS hints_enabled BOOLEAN NOT NULL DEFAULT false; + ALTER TABLE tests + ADD COLUMN IF NOT EXISTS result_mode VARCHAR(16) NOT NULL DEFAULT 'end'; + """ + ) + + +def downgrade() -> None: + op.execute( + """ + ALTER TABLE tests DROP COLUMN IF EXISTS hints_enabled; + ALTER TABLE tests DROP COLUMN IF EXISTS result_mode; + """ + )