diff --git a/alembic/versions/0febf8c21610_dropped_column_coding_mode.py b/alembic/versions/0febf8c21610_dropped_column_coding_mode.py new file mode 100644 index 0000000..42719e6 --- /dev/null +++ b/alembic/versions/0febf8c21610_dropped_column_coding_mode.py @@ -0,0 +1,37 @@ +"""dropped column coding_mode + +Revision ID: 0febf8c21610 +Revises: 4baf7c606f77 +Create Date: 2026-02-05 10:00:48.157541 + +""" +from typing import Sequence, Union + +from alembic import op + +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '0febf8c21610' +down_revision: Union[str, Sequence[str], None] = '4baf7c606f77' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + """Upgrade schema.""" + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('exercise', 'coding_mode') + op.add_column('exercise_progress', sa.Column('failed_submissions', sa.INTEGER(), nullable=False)) + op.add_column('exercise_progress', sa.Column('next_grading_allowed_at', sa.DateTime(timezone=True), nullable=True)) + # ### end Alembic commands ### + + +def downgrade() -> None: + """Downgrade schema.""" + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('exercise_progress', 'next_grading_allowed_at') + op.drop_column('exercise_progress', 'failed_submissions') + op.add_column('exercise', sa.Column('coding_mode', sa.VARCHAR(length=3), autoincrement=False, nullable=False)) + # ### end Alembic commands ### diff --git a/alembic/versions/3836d6b8e3f6_failed_submissions_and_next_grading_.py b/alembic/versions/3836d6b8e3f6_failed_submissions_and_next_grading_.py deleted file mode 100644 index 8035045..0000000 --- a/alembic/versions/3836d6b8e3f6_failed_submissions_and_next_grading_.py +++ /dev/null @@ -1,31 +0,0 @@ -"""failed_submissions and next_grading_allowed_at columns added to grading_job table - -Revision ID: 3836d6b8e3f6 -Revises: 4baf7c606f77 -Create Date: 2025-11-09 13:03:28.701620 - -""" -from typing import Sequence, Union - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision: str = '3836d6b8e3f6' -down_revision: Union[str, Sequence[str], None] = '4baf7c606f77' -branch_labels: Union[str, Sequence[str], None] = None -depends_on: Union[str, Sequence[str], None] = None - - -def upgrade() -> None: - """Upgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('exercise_progress', sa.Column('skipped', sa.BOOLEAN(), nullable=False)) - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('exercise_progress', 'skipped') - # ### end Alembic commands ### diff --git a/app/api/schema/exercise.py b/app/api/schema/exercise.py index e736890..66d890d 100644 --- a/app/api/schema/exercise.py +++ b/app/api/schema/exercise.py @@ -7,7 +7,6 @@ class ExerciseCreate(BaseModel): title: str markdown: str - coding_mode: str skip_delay: int next_exercise_id: Optional[int] diff --git a/app/db/model/exercise.py b/app/db/model/exercise.py index d674eff..04f9366 100644 --- a/app/db/model/exercise.py +++ b/app/db/model/exercise.py @@ -9,7 +9,6 @@ class Exercise(Base): id = sa.Column(sa.INTEGER, default=None, primary_key=True) title = sa.Column(sa.TEXT, nullable=False) markdown = sa.Column(sa.TEXT, nullable=False) - coding_mode = sa.Column(sa.VARCHAR(3), nullable=False) next_exercise_id = sa.Column(sa.Integer, sa.ForeignKey("exercise.id"), nullable=True) skip_delay = sa.Column(sa.Integer, nullable=False) @@ -18,7 +17,6 @@ def to_dict(self): "id": self.id, "title": self.title, "markdown": self.markdown, - "coding_mode": self.coding_mode, "next_exercise_id": self.next_exercise_id, "skip_delay": self.skip_delay, }