You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
5.5 KiB
120 lines
5.5 KiB
"""add pcp review |
|
|
|
Revision ID: d87b14d6a90c |
|
Revises: |
|
Create Date: 2020-07-21 21:47:51.061829 |
|
|
|
""" |
|
from alembic import op |
|
import sqlalchemy as sa |
|
|
|
|
|
# revision identifiers, used by Alembic. |
|
revision = 'd87b14d6a90c' |
|
down_revision = None |
|
branch_labels = None |
|
depends_on = None |
|
|
|
|
|
def upgrade(): |
|
# ### commands auto generated by Alembic - please adjust! ### |
|
op.create_table('game', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('name', sa.String(length=64), nullable=False), |
|
sa.Column('state', sa.Enum('hidden', 'published', 'active', 'interrupted', 'finished', name='gamestate'), server_default='hidden', nullable=False), |
|
sa.Column('start_time', sa.DateTime(), nullable=True), |
|
sa.Column('end_time', sa.DateTime(), nullable=True), |
|
sa.PrimaryKeyConstraint('id') |
|
) |
|
op.create_index(op.f('ix_game_name'), 'game', ['name'], unique=True) |
|
op.create_table('user', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('name', sa.String(length=64), nullable=False), |
|
sa.Column('auth_hash', sa.String(length=32), nullable=True), |
|
sa.Column('password_hash', sa.String(length=128), nullable=True), |
|
sa.Column('last_login', sa.DateTime(), nullable=True), |
|
sa.PrimaryKeyConstraint('id'), |
|
sa.UniqueConstraint('auth_hash'), |
|
sa.UniqueConstraint('name') |
|
) |
|
op.create_table('game_player', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('game_id', sa.Integer(), nullable=False), |
|
sa.Column('user_id', sa.Integer(), nullable=False), |
|
sa.Column('role', sa.Enum('none', 'owner', 'hunter', 'bunny', name='role'), server_default='none', nullable=False), |
|
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ), |
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), |
|
sa.PrimaryKeyConstraint('id'), |
|
sa.UniqueConstraint('game_id', 'user_id', name='_game_user_uc') |
|
) |
|
op.create_table('location', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('user_id', sa.Integer(), nullable=False), |
|
sa.Column('longitude', sa.Numeric(precision=15, scale=10, asdecimal=False), nullable=False), |
|
sa.Column('latitude', sa.Numeric(precision=15, scale=10, asdecimal=False), nullable=False), |
|
sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), |
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), |
|
sa.PrimaryKeyConstraint('id') |
|
) |
|
op.create_table('notification', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('game_id', sa.Integer(), nullable=False), |
|
sa.Column('message', sa.Text(), nullable=False), |
|
sa.Column('type', sa.String(length=64), nullable=False), |
|
sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), |
|
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ), |
|
sa.PrimaryKeyConstraint('id') |
|
) |
|
op.create_table('objective', |
|
sa.Column('id', sa.Integer(), nullable=False), |
|
sa.Column('name', sa.String(length=64), nullable=True), |
|
sa.Column('game_id', sa.Integer(), nullable=False), |
|
sa.Column('hash', sa.String(length=32), nullable=False), |
|
sa.Column('longitude', sa.Numeric(precision=15, scale=10, asdecimal=False), nullable=True), |
|
sa.Column('latitude', sa.Numeric(precision=15, scale=10, asdecimal=False), nullable=True), |
|
sa.ForeignKeyConstraint(['game_id'], ['game.id'], ), |
|
sa.PrimaryKeyConstraint('id'), |
|
sa.UniqueConstraint('hash') |
|
) |
|
op.create_table('notification_player', |
|
sa.Column('notification_id', sa.Integer(), nullable=False), |
|
sa.Column('game_player_id', sa.Integer(), nullable=False), |
|
sa.Column('been_shown', sa.Boolean(), server_default='True', nullable=False), |
|
sa.ForeignKeyConstraint(['game_player_id'], ['game_player.id'], ), |
|
sa.ForeignKeyConstraint(['notification_id'], ['notification.id'], ), |
|
sa.PrimaryKeyConstraint('notification_id', 'game_player_id') |
|
) |
|
op.create_table('player_caught_player', |
|
sa.Column('id', sa.Integer(), server_default='-1', autoincrement=True, nullable=False), |
|
sa.Column('catching_player_id', sa.Integer(), nullable=False), |
|
sa.Column('caught_player_id', sa.Integer(), nullable=False), |
|
sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), |
|
sa.Column('review', sa.Enum('none', 'denied', 'accepted', name='review'), server_default='none', nullable=False), |
|
sa.ForeignKeyConstraint(['catching_player_id'], ['game_player.id'], ), |
|
sa.ForeignKeyConstraint(['caught_player_id'], ['game_player.id'], ), |
|
sa.PrimaryKeyConstraint('id') |
|
) |
|
op.create_table('player_found_objective', |
|
sa.Column('objective_id', sa.Integer(), server_default='-1', nullable=False), |
|
sa.Column('game_player_id', sa.Integer(), server_default='-1', nullable=False), |
|
sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), |
|
sa.ForeignKeyConstraint(['game_player_id'], ['game_player.id'], ), |
|
sa.ForeignKeyConstraint(['objective_id'], ['objective.id'], ), |
|
sa.PrimaryKeyConstraint('objective_id', 'game_player_id') |
|
) |
|
# ### end Alembic commands ### |
|
|
|
|
|
def downgrade(): |
|
# ### commands auto generated by Alembic - please adjust! ### |
|
op.drop_table('player_found_objective') |
|
op.drop_table('player_caught_player') |
|
op.drop_table('notification_player') |
|
op.drop_table('objective') |
|
op.drop_table('notification') |
|
op.drop_table('location') |
|
op.drop_table('game_player') |
|
op.drop_table('user') |
|
op.drop_index(op.f('ix_game_name'), table_name='game') |
|
op.drop_table('game') |
|
# ### end Alembic commands ###
|
|
|