|
| 1 | +"""add packet |
| 2 | +
|
| 3 | +Revision ID: 27b8305621f5 |
| 4 | +Revises: 05126dcdf40e |
| 5 | +Create Date: 2025-09-10 09:36:50.644872 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +# revision identifiers, used by Alembic. |
| 10 | +revision = '27b8305621f5' |
| 11 | +down_revision = '05126dcdf40e' |
| 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.create_table('freshman', |
| 20 | + sa.Column('rit_username', sa.String(length=10), nullable=False), |
| 21 | + sa.Column('name', sa.String(length=64), nullable=False), |
| 22 | + sa.Column('onfloor', sa.Boolean(), nullable=False), |
| 23 | + sa.PrimaryKeyConstraint('rit_username') |
| 24 | + ) |
| 25 | + op.create_table('notification_subscriptions', |
| 26 | + sa.Column('member', sa.String(length=36), nullable=True), |
| 27 | + sa.Column('freshman_username', sa.String(length=10), nullable=True), |
| 28 | + sa.Column('token', sa.String(length=256), nullable=False), |
| 29 | + sa.ForeignKeyConstraint(['freshman_username'], ['freshman.rit_username'], ), |
| 30 | + sa.PrimaryKeyConstraint('token') |
| 31 | + ) |
| 32 | + op.create_table('packet', |
| 33 | + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), |
| 34 | + sa.Column('freshman_username', sa.String(length=10), nullable=True), |
| 35 | + sa.Column('start', sa.DateTime(), nullable=False), |
| 36 | + sa.Column('end', sa.DateTime(), nullable=False), |
| 37 | + sa.ForeignKeyConstraint(['freshman_username'], ['freshman.rit_username'], ), |
| 38 | + sa.PrimaryKeyConstraint('id') |
| 39 | + ) |
| 40 | + op.create_table('signature_fresh', |
| 41 | + sa.Column('packet_id', sa.Integer(), nullable=False), |
| 42 | + sa.Column('freshman_username', sa.String(length=10), nullable=False), |
| 43 | + sa.Column('signed', sa.Boolean(), nullable=False), |
| 44 | + sa.Column('updated', sa.DateTime(), nullable=False), |
| 45 | + sa.ForeignKeyConstraint(['freshman_username'], ['freshman.rit_username'], ), |
| 46 | + sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ), |
| 47 | + sa.PrimaryKeyConstraint('packet_id', 'freshman_username') |
| 48 | + ) |
| 49 | + op.create_table('signature_misc', |
| 50 | + sa.Column('packet_id', sa.Integer(), nullable=False), |
| 51 | + sa.Column('member', sa.String(length=36), nullable=False), |
| 52 | + sa.Column('updated', sa.DateTime(), nullable=False), |
| 53 | + sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ), |
| 54 | + sa.PrimaryKeyConstraint('packet_id', 'member') |
| 55 | + ) |
| 56 | + op.create_table('signature_upper', |
| 57 | + sa.Column('packet_id', sa.Integer(), nullable=False), |
| 58 | + sa.Column('member', sa.String(length=36), nullable=False), |
| 59 | + sa.Column('signed', sa.Boolean(), nullable=False), |
| 60 | + sa.Column('eboard', sa.String(length=12), nullable=True), |
| 61 | + sa.Column('active_rtp', sa.Boolean(), nullable=False), |
| 62 | + sa.Column('three_da', sa.Boolean(), nullable=False), |
| 63 | + sa.Column('webmaster', sa.Boolean(), nullable=False), |
| 64 | + sa.Column('c_m', sa.Boolean(), nullable=False), |
| 65 | + sa.Column('w_m', sa.Boolean(), nullable=False), |
| 66 | + sa.Column('drink_admin', sa.Boolean(), nullable=False), |
| 67 | + sa.Column('updated', sa.DateTime(), nullable=False), |
| 68 | + sa.ForeignKeyConstraint(['packet_id'], ['packet.id'], ), |
| 69 | + sa.PrimaryKeyConstraint('packet_id', 'member') |
| 70 | + ) |
| 71 | + with op.batch_alter_table('freshman_accounts', schema=None) as batch_op: |
| 72 | + batch_op.drop_column('real_signatures_missed') |
| 73 | + |
| 74 | + with op.batch_alter_table('freshman_eval_data', schema=None) as batch_op: |
| 75 | + batch_op.drop_column('real_signatures_missed') |
| 76 | + |
| 77 | + # ### end Alembic commands ### |
| 78 | + |
| 79 | + |
| 80 | +def downgrade(): |
| 81 | + # ### commands auto generated by Alembic - please adjust! ### |
| 82 | + with op.batch_alter_table('freshman_eval_data', schema=None) as batch_op: |
| 83 | + batch_op.add_column(sa.Column('real_signatures_missed', sa.INTEGER(), server_default=sa.text("'-1'::integer"), autoincrement=False, nullable=False)) |
| 84 | + |
| 85 | + with op.batch_alter_table('freshman_accounts', schema=None) as batch_op: |
| 86 | + batch_op.add_column(sa.Column('real_signatures_missed', sa.INTEGER(), server_default=sa.text("'-1'::integer"), autoincrement=False, nullable=False)) |
| 87 | + |
| 88 | + op.drop_table('signature_upper') |
| 89 | + op.drop_table('signature_misc') |
| 90 | + op.drop_table('signature_fresh') |
| 91 | + op.drop_table('packet') |
| 92 | + op.drop_table('notification_subscriptions') |
| 93 | + op.drop_table('freshman') |
| 94 | + # ### end Alembic commands ### |
0 commit comments