-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy path885bc158af44_add_evaluation_strategy_to_modelsession.py
More file actions
50 lines (37 loc) · 1.81 KB
/
Copy path885bc158af44_add_evaluation_strategy_to_modelsession.py
File metadata and controls
50 lines (37 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""Add evaluation_strategy to ModelSession
Revision ID: 885bc158af44
Revises: b4f9e70098e7
Create Date: 2026-04-29 16:31:34.248290
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '885bc158af44'
down_revision: Union[str, None] = 'b4f9e70098e7'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('metric', schema=None) as batch_op:
batch_op.add_column(sa.Column('fold_index', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('inner_fold_index', sa.Integer(), nullable=True))
batch_op.alter_column('level',
existing_type=sa.VARCHAR(length=5),
type_=sa.Enum('LAST', 'TRIAL', 'STEP', 'EPOCH', 'FOLD', 'OUTER_FOLD', name='levelenum'),
existing_nullable=False)
with op.batch_alter_table('model_session', schema=None) as batch_op:
batch_op.add_column(sa.Column('evaluation_strategy', sa.String(), nullable=False))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('model_session', schema=None) as batch_op:
batch_op.drop_column('evaluation_strategy')
with op.batch_alter_table('metric', schema=None) as batch_op:
batch_op.alter_column('level',
existing_type=sa.Enum('LAST', 'TRIAL', 'STEP', 'EPOCH', 'FOLD', 'OUTER_FOLD', name='levelenum'),
type_=sa.VARCHAR(length=5),
existing_nullable=False)
batch_op.drop_column('inner_fold_index')
batch_op.drop_column('fold_index')
# ### end Alembic commands ###