q3stats/alembic/versions/3509d93df7c_create_table_scores.py

45 lines
1.2 KiB
Python
Raw Normal View History

2017-03-06 19:33:09 +00:00
"""Create table `scores`.
Revision ID: 3509d93df7c
Revises: 32ecefbbf8d3
Create Date: 2015-02-21 13:27:28.102629
"""
# revision identifiers, used by Alembic.
revision = '3509d93df7c'
down_revision = '32ecefbbf8d3'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
import sqlalchemy.dialects.postgresql as pg
def upgrade():
op.create_table(
'scores',
sa.Column('id', sa.Integer(), primary_key=True),
sa.Column(
'game_id', sa.Integer(), sa.ForeignKey('games.id'), index=True
),
sa.Column('player', sa.String(255), index=True),
sa.Column('score', sa.Integer()),
sa.Column('kills', sa.Integer()),
sa.Column('deaths', sa.Integer()),
sa.Column('suicides', sa.Integer()),
sa.Column('net', sa.Integer()),
sa.Column('damage_taken', sa.Integer()),
sa.Column('damage_given', sa.Integer()),
sa.Column('total_health', sa.Integer()),
sa.Column('total_armor', sa.Integer()),
sa.Column('weapons', pg.JSON()),
sa.Column('items', pg.JSON()),
sa.Column('powerups', pg.JSON()),
)
def downgrade():
op.drop_table('scores')