mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 05:24:20 +00:00
158 lines
6.7 KiB
Python
158 lines
6.7 KiB
Python
"""First revision
|
|
|
|
Revision ID: c6aacbd5d796
|
|
Revises:
|
|
Create Date: 2021-04-25 01:00:49.131019
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlalchemy_utils
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'c6aacbd5d796'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('titles',
|
|
sa.Column('uuid', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('visible', sa.Boolean(), nullable=False),
|
|
sa.Column('locked_description', sa.Text(), nullable=False),
|
|
sa.Column('unlocked_description', sa.Text(), nullable=False),
|
|
sa.PrimaryKeyConstraint('uuid')
|
|
)
|
|
op.create_table('users',
|
|
sa.Column('sub', sa.String(), nullable=False),
|
|
sa.Column('last_update', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('nickname', sa.String(), nullable=False),
|
|
sa.Column('avatar', sa.String(), nullable=False),
|
|
sa.Column('email', sa.String(), nullable=False),
|
|
sa.Column('bio', sa.Text(), nullable=False),
|
|
sa.Column('color', sqlalchemy_utils.types.color.ColorType(length=20), nullable=False),
|
|
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
|
|
sa.Column('fiorygi', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
|
|
sa.PrimaryKeyConstraint('sub')
|
|
)
|
|
op.create_table('accounts_discord',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('id', sa.BigInteger(), nullable=False),
|
|
sa.Column('username', sa.String(), nullable=False),
|
|
sa.Column('discriminator', sa.SmallInteger(), nullable=False),
|
|
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('accounts_league',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('region', sa.String(), nullable=False),
|
|
sa.Column('puuid', sa.String(), nullable=False),
|
|
sa.Column('summoner_name', sa.String(), nullable=False),
|
|
sa.Column('avatar_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('puuid')
|
|
)
|
|
op.create_table('accounts_osu',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('id', sa.BigInteger(), nullable=False),
|
|
sa.Column('username', sa.String(), nullable=True),
|
|
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('accounts_steam',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('steamid', sa.BigInteger(), nullable=False),
|
|
sa.Column('persona_name', sa.String(), nullable=False),
|
|
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('steamid')
|
|
)
|
|
op.create_table('accounts_telegram',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('id', sa.BigInteger(), nullable=False),
|
|
sa.Column('first_name', sa.String(), nullable=False),
|
|
sa.Column('last_name', sa.String(), nullable=True),
|
|
sa.Column('username', sa.String(), nullable=True),
|
|
sa.Column('avatar_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('diario_groups',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('saved_by_fk', sa.String(), nullable=False),
|
|
sa.Column('context', sa.Text(), nullable=True),
|
|
sa.ForeignKeyConstraint(['saved_by_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('fiorygi_transactions',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('minus_fk', sa.String(), nullable=True),
|
|
sa.Column('plus_fk', sa.String(), nullable=True),
|
|
sa.Column('amount', sa.Integer(), nullable=False),
|
|
sa.Column('reason', sa.Text(), nullable=True),
|
|
sa.ForeignKeyConstraint(['minus_fk'], ['users.sub'], ),
|
|
sa.ForeignKeyConstraint(['plus_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('fiorygi_treasures',
|
|
sa.Column('slug', sa.String(), nullable=False),
|
|
sa.Column('creator_fk', sa.String(), nullable=True),
|
|
sa.Column('finder_fk', sa.String(), nullable=True),
|
|
sa.Column('value', sa.Integer(), nullable=False),
|
|
sa.Column('message', sa.Text(), nullable=True),
|
|
sa.ForeignKeyConstraint(['creator_fk'], ['users.sub'], ),
|
|
sa.ForeignKeyConstraint(['finder_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('slug')
|
|
)
|
|
op.create_table('user_aliases',
|
|
sa.Column('user_fk', sa.String(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('user_fk', 'name')
|
|
)
|
|
op.create_table('user_title_association',
|
|
sa.Column('user_fk', sa.String(), nullable=True),
|
|
sa.Column('title_fk', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True),
|
|
sa.ForeignKeyConstraint(['title_fk'], ['titles.uuid'], ),
|
|
sa.ForeignKeyConstraint(['user_fk'], ['users.sub'], )
|
|
)
|
|
op.create_table('diario_lines',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('diario_group_fk', sa.Integer(), nullable=False),
|
|
sa.Column('text', sa.Text(), nullable=True),
|
|
sa.Column('media_url', sqlalchemy_utils.types.url.URLType(), nullable=True),
|
|
sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
|
|
sa.Column('spoiler', sa.String(), nullable=True),
|
|
sa.Column('quoted_str', sa.String(), nullable=True),
|
|
sa.Column('quoted_user_fk', sa.String(), nullable=True),
|
|
sa.ForeignKeyConstraint(['diario_group_fk'], ['diario_groups.id'], ),
|
|
sa.ForeignKeyConstraint(['quoted_user_fk'], ['users.sub'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('diario_lines')
|
|
op.drop_table('user_title_association')
|
|
op.drop_table('user_aliases')
|
|
op.drop_table('fiorygi_treasures')
|
|
op.drop_table('fiorygi_transactions')
|
|
op.drop_table('diario_groups')
|
|
op.drop_table('accounts_telegram')
|
|
op.drop_table('accounts_steam')
|
|
op.drop_table('accounts_osu')
|
|
op.drop_table('accounts_league')
|
|
op.drop_table('accounts_discord')
|
|
op.drop_table('users')
|
|
op.drop_table('titles')
|
|
# ### end Alembic commands ###
|