Skip to content

Commit e1d7072

Browse files
committed
Add conditional->eval relationship in DB
1 parent 0d64510 commit e1d7072

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

migrations/versions/5615d58892a1_.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Allow for Spring and Intro eval relationships
2+
3+
Revision ID: 5615d58892a1
4+
Revises: 6f6b843e2b8f
5+
Create Date: 2017-04-27 15:40:40.640402
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = '5615d58892a1'
11+
down_revision = '6f6b843e2b8f'
12+
13+
from alembic import op
14+
import sqlalchemy as sa
15+
16+
17+
def upgrade():
18+
### commands auto generated by Alembic - please adjust! ###
19+
op.add_column('conditional', sa.Column('i_evaluation', sa.Integer(), nullable=True))
20+
op.add_column('conditional', sa.Column('s_evaluation', sa.Integer(), nullable=True))
21+
op.drop_constraint('conditional_evaluation_fkey', 'conditional', type_='foreignkey')
22+
op.create_foreign_key(None, 'conditional', 'spring_evals', ['s_evaluation'], ['id'])
23+
op.create_foreign_key(None, 'conditional', 'freshman_eval_data', ['i_evaluation'], ['id'])
24+
op.drop_column('conditional', 'evaluation')
25+
### end Alembic commands ###
26+
27+
28+
def downgrade():
29+
### commands auto generated by Alembic - please adjust! ###
30+
op.add_column('conditional', sa.Column('evaluation', sa.INTEGER(), autoincrement=False, nullable=True))
31+
op.drop_constraint(None, 'conditional', type_='foreignkey')
32+
op.drop_constraint(None, 'conditional', type_='foreignkey')
33+
op.create_foreign_key('conditional_evaluation_fkey', 'conditional', 'spring_evals', ['evaluation'], ['id'])
34+
op.drop_column('conditional', 's_evaluation')
35+
op.drop_column('conditional', 'i_evaluation')
36+
### end Alembic commands ###

migrations/versions/6f6b843e2b8f_.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Add relation between Conditional and Eval
2+
3+
Revision ID: 6f6b843e2b8f
4+
Revises: e72e5d4d71f2
5+
Create Date: 2017-04-26 19:44:14.159135
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = '6f6b843e2b8f'
11+
down_revision = 'e72e5d4d71f2'
12+
13+
from alembic import op
14+
import sqlalchemy as sa
15+
16+
17+
def upgrade():
18+
### commands auto generated by Alembic - please adjust! ###
19+
op.add_column('conditional', sa.Column('evaluation', sa.Integer(), nullable=True))
20+
op.create_foreign_key(None, 'conditional', 'spring_evals', ['evaluation'], ['id'])
21+
### end Alembic commands ###
22+
23+
24+
def downgrade():
25+
### commands auto generated by Alembic - please adjust! ###
26+
op.drop_constraint(None, 'conditional', type_='foreignkey')
27+
op.drop_column('conditional', 'evaluation')
28+
### end Alembic commands ###

0 commit comments

Comments
 (0)