Skip to content

Commit 7230499

Browse files
authored
Fix: Refactor(migrations), replace obsolete migration for categories_added and category_error columns (#143)
- Removed the previous migration script that added 'categories_added' and 'category_error' columns to the submissions table. - Introduced a new migration script that includes these columns along with additional changes to the contests table, enhancing the overall structure and functionality. Fixes #109
2 parents 26235a0 + 91c0ca1 commit 7230499

File tree

2 files changed

+73
-31
lines changed

2 files changed

+73
-31
lines changed

backend/alembic/versions/8ecb36347b53_add_categories_added_and_category_error_.py

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
"""Add categories_added and category_error columns to submissions table
2+
3+
Revision ID: ed3dabd7833f
4+
Revises: c4d1d7879989
5+
Create Date: 2026-01-14 16:17:46.783789
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from sqlalchemy.dialects import mysql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = 'ed3dabd7833f'
14+
down_revision = 'c4d1d7879989'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade() -> None:
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.add_column('contests', sa.Column('template_link', sa.Text(), nullable=True))
22+
op.alter_column('contests', 'scoring_parameters',
23+
existing_type=mysql.TEXT(),
24+
comment=None,
25+
existing_comment='Weights for scoring parameters',
26+
existing_nullable=True)
27+
op.alter_column('contests', 'min_reference_count',
28+
existing_type=mysql.INTEGER(),
29+
server_default=None,
30+
comment=None,
31+
existing_comment='Minimum number of references required for article submissions',
32+
existing_nullable=False)
33+
op.alter_column('contests', 'organizers',
34+
existing_type=mysql.TEXT(),
35+
comment=None,
36+
existing_comment='Comma-separated list of organizer usernames',
37+
existing_nullable=True)
38+
op.add_column('submissions', sa.Column('template_added', sa.Boolean(), nullable=True))
39+
op.add_column('submissions', sa.Column('categories_added', sa.Text(), nullable=True))
40+
op.add_column('submissions', sa.Column('category_error', sa.Text(), nullable=True))
41+
op.alter_column('submissions', 'parameter_scores',
42+
existing_type=mysql.TEXT(),
43+
comment=None,
44+
existing_comment='Per-parameter jury scores and comments',
45+
existing_nullable=True)
46+
# ### end Alembic commands ###
47+
48+
49+
def downgrade() -> None:
50+
# ### commands auto generated by Alembic - please adjust! ###
51+
op.alter_column('submissions', 'parameter_scores',
52+
existing_type=mysql.TEXT(),
53+
comment='Per-parameter jury scores and comments',
54+
existing_nullable=True)
55+
op.drop_column('submissions', 'category_error')
56+
op.drop_column('submissions', 'categories_added')
57+
op.drop_column('submissions', 'template_added')
58+
op.alter_column('contests', 'organizers',
59+
existing_type=mysql.TEXT(),
60+
comment='Comma-separated list of organizer usernames',
61+
existing_nullable=True)
62+
op.alter_column('contests', 'min_reference_count',
63+
existing_type=mysql.INTEGER(),
64+
server_default=sa.text("'0'"),
65+
comment='Minimum number of references required for article submissions',
66+
existing_nullable=False)
67+
op.alter_column('contests', 'scoring_parameters',
68+
existing_type=mysql.TEXT(),
69+
comment='Weights for scoring parameters',
70+
existing_nullable=True)
71+
op.drop_column('contests', 'template_link')
72+
# ### end Alembic commands ###
73+

0 commit comments

Comments
 (0)