386c94d11473_rename_personal_to_player.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """rename personal to player
  2. Revision ID: 386c94d11473
  3. Revises: 594ad25dd1b7
  4. Create Date: 2019-09-09 17:39:59.800271
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '386c94d11473'
  10. down_revision = '594ad25dd1b7'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. op.create_table('player_market_stat',
  15. sa.Column('id', sa.Integer(), nullable=False),
  16. sa.Column('item_type', sa.SmallInteger(), nullable=True),
  17. sa.Column('price', sa.Integer(), nullable=True),
  18. sa.Column('amount', sa.BigInteger(), nullable=True),
  19. sa.Column('total_offers', sa.Integer(), nullable=True),
  20. sa.Column('player_id', sa.Integer(), nullable=True),
  21. sa.Column('market_track_id', sa.Integer(), nullable=True),
  22. sa.ForeignKeyConstraint(['market_track_id'], ['market_track.id'], name=op.f('fk_player_market_stat_market_track_id_market_track')),
  23. sa.ForeignKeyConstraint(['player_id'], ['player.id'], name=op.f('fk_player_market_stat_player_id_player')),
  24. sa.PrimaryKeyConstraint('id', name=op.f('pk_player_market_stat'))
  25. )
  26. op.drop_table('personal_market_stat')
  27. def downgrade():
  28. op.create_table('personal_market_stat',
  29. sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
  30. sa.Column('item_type', sa.SMALLINT(), autoincrement=False, nullable=True),
  31. sa.Column('price', sa.INTEGER(), autoincrement=False, nullable=True),
  32. sa.Column('market_track_id', sa.INTEGER(), autoincrement=False, nullable=True),
  33. sa.Column('amount', sa.BIGINT(), autoincrement=False, nullable=True),
  34. sa.Column('player_id', sa.INTEGER(), autoincrement=False, nullable=True),
  35. sa.Column('total_offers', sa.INTEGER(), autoincrement=False, nullable=True),
  36. sa.ForeignKeyConstraint(['market_track_id'], ['market_track.id'], name='fk_personal_market_stat_market_track_id_market_track'),
  37. sa.ForeignKeyConstraint(['player_id'], ['player.id'], name='fk_personal_market_stat_player_id_player'),
  38. sa.PrimaryKeyConstraint('id', name='pk_personal_market_stat')
  39. )
  40. op.drop_table('player_market_stat')