a5cc743d9119_update_player_join_tables.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """update player join tables
  2. Revision ID: a5cc743d9119
  3. Revises: ba34a39acf0e
  4. Create Date: 2019-09-03 11:42:13.438545
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = 'a5cc743d9119'
  10. down_revision = 'ba34a39acf0e'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. op.add_column('election_stat', sa.Column('party_id', sa.Integer(), nullable=True))
  15. op.create_foreign_key(op.f('fk_election_stat_party_id_party'), 'election_stat', 'party', ['party_id'], ['id'])
  16. op.add_column('player_location', sa.Column('from_date_time', sa.DateTime(), nullable=True))
  17. op.add_column('player_location', sa.Column('until_date_time', sa.DateTime(), nullable=True))
  18. op.add_column('player_party', sa.Column('from_date_time', sa.DateTime(), nullable=True))
  19. op.add_column('player_party', sa.Column('until_date_time', sa.DateTime(), nullable=True))
  20. op.add_column('player_residency', sa.Column('from_date_time', sa.DateTime(), nullable=True))
  21. op.add_column('player_residency', sa.Column('until_date_time', sa.DateTime(), nullable=True))
  22. def downgrade():
  23. op.drop_column('player_residency', 'until_date_time')
  24. op.drop_column('player_residency', 'from_date_time')
  25. op.drop_column('player_party', 'until_date_time')
  26. op.drop_column('player_party', 'from_date_time')
  27. op.drop_column('player_location', 'until_date_time')
  28. op.drop_column('player_location', 'from_date_time')
  29. op.drop_constraint(op.f('fk_election_stat_party_id_party'), 'election_stat', type_='foreignkey')
  30. op.drop_column('election_stat', 'party_id')