Skip to content

Commit 02d8a5d

Browse files
committed
db migration 1
1 parent 9d87795 commit 02d8a5d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""add major project fields
2+
3+
Revision ID: 05126dcdf40e
4+
Revises: 757e18146d16
5+
Create Date: 2024-09-15 00:20:50.617251
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = '05126dcdf40e'
11+
down_revision = '757e18146d16'
12+
13+
from alembic import op
14+
import sqlalchemy as sa
15+
from sqlalchemy.dialects import postgresql
16+
17+
def upgrade():
18+
# ### commands auto generated by Alembic - please adjust! ###
19+
op.drop_table('freshman_batch_pulls')
20+
op.drop_table('batch_conditions')
21+
op.drop_table('freshman_batch_users')
22+
op.drop_table('batch')
23+
op.drop_table('member_batch_users')
24+
op.drop_table('member_batch_pulls')
25+
op.alter_column('freshman_hm_attendance', 'attendance_status',
26+
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
27+
nullable=True)
28+
op.add_column('major_projects', sa.Column('time', sa.Text(), nullable=False))
29+
op.add_column('major_projects', sa.Column('tldr', sa.String(length=128), nullable=False))
30+
op.alter_column('major_projects', 'description',
31+
existing_type=sa.TEXT(),
32+
nullable=False)
33+
op.alter_column('member_hm_attendance', 'attendance_status',
34+
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
35+
nullable=True)
36+
# ### end Alembic commands ###
37+
38+
39+
def downgrade():
40+
# ### commands auto generated by Alembic - please adjust! ###
41+
op.alter_column('member_hm_attendance', 'attendance_status',
42+
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
43+
nullable=False)
44+
op.alter_column('major_projects', 'description',
45+
existing_type=sa.TEXT(),
46+
nullable=True)
47+
op.drop_column('major_projects', 'tldr')
48+
op.drop_column('major_projects', 'time')
49+
op.alter_column('freshman_hm_attendance', 'attendance_status',
50+
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
51+
nullable=False)
52+
op.create_table('member_batch_pulls',
53+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
54+
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=False),
55+
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False),
56+
sa.Column('reason', sa.TEXT(), autoincrement=False, nullable=False),
57+
sa.Column('puller', sa.VARCHAR(), autoincrement=False, nullable=False)
58+
)
59+
op.create_table('member_batch_users',
60+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
61+
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
62+
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
63+
)
64+
op.create_table('batch',
65+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
66+
sa.Column('name', sa.TEXT(), autoincrement=False, nullable=False),
67+
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
68+
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False)
69+
)
70+
op.create_table('freshman_batch_users',
71+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
72+
sa.Column('fid', sa.INTEGER(), autoincrement=False, nullable=False),
73+
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
74+
)
75+
op.create_table('batch_conditions',
76+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
77+
sa.Column('value', sa.INTEGER(), autoincrement=False, nullable=False),
78+
sa.Column('condition', postgresql.ENUM('packet', 'seminar', 'committee', 'house', name='batch_ctype_enum'), autoincrement=False, nullable=False),
79+
sa.Column('comparison', postgresql.ENUM('less', 'equal', 'greater', name='batch_comparison'), autoincrement=False, nullable=False),
80+
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
81+
)
82+
op.create_table('freshman_batch_pulls',
83+
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
84+
sa.Column('fid', sa.INTEGER(), autoincrement=False, nullable=False),
85+
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False),
86+
sa.Column('reason', sa.TEXT(), autoincrement=False, nullable=False),
87+
sa.Column('puller', sa.VARCHAR(), autoincrement=False, nullable=False)
88+
)
89+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)