6a81f102bb33_add_work_permit_table.py 975 B

1234567891011121314151617181920212223242526272829303132
  1. """add work permit table
  2. Revision ID: 6a81f102bb33
  3. Revises: 96951df04b3b
  4. Create Date: 2019-09-05 12:46:29.077779
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '6a81f102bb33'
  10. down_revision = '96951df04b3b'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. op.create_table('state_work_permit',
  15. sa.Column('state_id', sa.Integer(), nullable=False),
  16. sa.Column('player_id', sa.Integer(), nullable=False),
  17. sa.Column('from_date_time', sa.DateTime(), nullable=True),
  18. sa.Column('until_date_time', sa.DateTime(), nullable=True),
  19. sa.ForeignKeyConstraint(['player_id'], ['player.id'], name=op.f('fk_state_work_permit_player_id_player')),
  20. sa.ForeignKeyConstraint(['state_id'], ['state.id'], name=op.f('fk_state_work_permit_state_id_state')),
  21. sa.PrimaryKeyConstraint('state_id', 'player_id', name=op.f('pk_state_work_permit'))
  22. )
  23. def downgrade():
  24. op.drop_table('state_work_permit')