1547a089e232_add_market_track.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """add market track
  2. Revision ID: 1547a089e232
  3. Revises: a5cc743d9119
  4. Create Date: 2019-09-03 12:02:55.635717
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '1547a089e232'
  10. down_revision = 'a5cc743d9119'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. op.create_table('market_track',
  15. sa.Column('id', sa.Integer(), nullable=False),
  16. sa.Column('date_time', sa.DateTime(), nullable=True),
  17. sa.PrimaryKeyConstraint('id', name=op.f('pk_market_track'))
  18. )
  19. op.create_table('personal_market_stat',
  20. sa.Column('id', sa.Integer(), nullable=False),
  21. sa.Column('item_type', sa.SmallInteger(), nullable=True),
  22. sa.Column('price', sa.Integer(), nullable=True),
  23. sa.Column('market_track_id', sa.Integer(), nullable=True),
  24. sa.ForeignKeyConstraint(['market_track_id'], ['market_track.id'], name=op.f('fk_personal_market_stat_market_track_id_market_track')),
  25. sa.PrimaryKeyConstraint('id', name=op.f('pk_personal_market_stat'))
  26. )
  27. op.create_table('state_market_stat',
  28. sa.Column('id', sa.Integer(), nullable=False),
  29. sa.Column('item_type', sa.SmallInteger(), nullable=True),
  30. sa.Column('price', sa.Integer(), nullable=True),
  31. sa.Column('market_track_id', sa.Integer(), nullable=True),
  32. sa.ForeignKeyConstraint(['market_track_id'], ['market_track.id'], name=op.f('fk_state_market_stat_market_track_id_market_track')),
  33. sa.PrimaryKeyConstraint('id', name=op.f('pk_state_market_stat'))
  34. )
  35. def downgrade():
  36. op.drop_table('state_market_stat')
  37. op.drop_table('personal_market_stat')
  38. op.drop_table('market_track')