Skip to content

Commit

Permalink
db migration 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobmaker55 committed Sep 15, 2024
1 parent 9d87795 commit 02d8a5d
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions migrations/versions/05126dcdf40e_add_mp_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
"""add major project fields
Revision ID: 05126dcdf40e
Revises: 757e18146d16
Create Date: 2024-09-15 00:20:50.617251
"""

# revision identifiers, used by Alembic.
revision = '05126dcdf40e'
down_revision = '757e18146d16'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('freshman_batch_pulls')
op.drop_table('batch_conditions')
op.drop_table('freshman_batch_users')
op.drop_table('batch')
op.drop_table('member_batch_users')
op.drop_table('member_batch_pulls')
op.alter_column('freshman_hm_attendance', 'attendance_status',
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
nullable=True)
op.add_column('major_projects', sa.Column('time', sa.Text(), nullable=False))
op.add_column('major_projects', sa.Column('tldr', sa.String(length=128), nullable=False))
op.alter_column('major_projects', 'description',
existing_type=sa.TEXT(),
nullable=False)
op.alter_column('member_hm_attendance', 'attendance_status',
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
nullable=True)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('member_hm_attendance', 'attendance_status',
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
nullable=False)
op.alter_column('major_projects', 'description',
existing_type=sa.TEXT(),
nullable=True)
op.drop_column('major_projects', 'tldr')
op.drop_column('major_projects', 'time')
op.alter_column('freshman_hm_attendance', 'attendance_status',
existing_type=postgresql.ENUM('Attended', 'Excused', 'Absent', name='attendance_enum'),
nullable=False)
op.create_table('member_batch_pulls',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=False),
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.Column('reason', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('puller', sa.VARCHAR(), autoincrement=False, nullable=False)
)
op.create_table('member_batch_users',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
)
op.create_table('batch',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('name', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('uid', sa.VARCHAR(length=32), autoincrement=False, nullable=True),
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False)
)
op.create_table('freshman_batch_users',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('fid', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
)
op.create_table('batch_conditions',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('value', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('condition', postgresql.ENUM('packet', 'seminar', 'committee', 'house', name='batch_ctype_enum'), autoincrement=False, nullable=False),
sa.Column('comparison', postgresql.ENUM('less', 'equal', 'greater', name='batch_comparison'), autoincrement=False, nullable=False),
sa.Column('batch_id', sa.INTEGER(), autoincrement=False, nullable=False)
)
op.create_table('freshman_batch_pulls',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('fid', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('approved', sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.Column('reason', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('puller', sa.VARCHAR(), autoincrement=False, nullable=False)
)
# ### end Alembic commands ###

0 comments on commit 02d8a5d

Please sign in to comment.