71 lines
3.5 KiB
Python
71 lines
3.5 KiB
Python
|
"""init
|
||
|
|
||
|
Revision ID: 1da33402b659
|
||
|
Revises:
|
||
|
Create Date: 2022-05-19 15:50:19.539401
|
||
|
|
||
|
"""
|
||
|
import sqlalchemy as sa
|
||
|
from alembic import op
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '1da33402b659'
|
||
|
down_revision = None
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('notification',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('type', sa.String(length=50), nullable=False),
|
||
|
sa.Column('message', sa.String(length=300), nullable=False),
|
||
|
sa.Column('medium', sa.String(length=50), nullable=False),
|
||
|
sa.Column('success', sa.Boolean(), nullable=False),
|
||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
op.create_table('steam_item',
|
||
|
sa.Column('steam_id', sa.String(length=15), nullable=False),
|
||
|
sa.Column('game_name', sa.String(length=200), nullable=False),
|
||
|
sa.Column('steam_url', sa.String(length=100), nullable=False),
|
||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.PrimaryKeyConstraint('steam_id')
|
||
|
)
|
||
|
op.create_table('giveaway',
|
||
|
sa.Column('giveaway_id', sa.String(length=10), nullable=False),
|
||
|
sa.Column('steam_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('giveaway_uri', sa.String(length=200), nullable=False),
|
||
|
sa.Column('user', sa.String(length=40), nullable=False),
|
||
|
sa.Column('giveaway_created_at', sa.DateTime(timezone=True), nullable=False),
|
||
|
sa.Column('giveaway_ended_at', sa.DateTime(timezone=True), nullable=False),
|
||
|
sa.Column('cost', sa.Integer(), nullable=False),
|
||
|
sa.Column('copies', sa.Integer(), nullable=False),
|
||
|
sa.Column('contributor_level', sa.Integer(), nullable=False),
|
||
|
sa.Column('entered', sa.Boolean(), nullable=False),
|
||
|
sa.Column('won', sa.Boolean(), nullable=False),
|
||
|
sa.Column('game_entries', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'),
|
||
|
nullable=True),
|
||
|
sa.ForeignKeyConstraint(['steam_id'], ['steam_item.steam_id'], ),
|
||
|
sa.PrimaryKeyConstraint('giveaway_id', 'steam_id')
|
||
|
)
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('giveaway')
|
||
|
op.drop_table('steam_item')
|
||
|
op.drop_table('notification')
|
||
|
# ### end Alembic commands ###
|