1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/royalpack/database/alembic/versions/c6aacbd5d796_first_revision.py

158 lines
8.3 KiB
Python
Raw Normal View History

2021-04-25 00:31:15 +00:00
"""First revision
2021-04-17 22:39:43 +00:00
2021-04-25 00:31:15 +00:00
Revision ID: c6aacbd5d796
2021-04-17 22:39:43 +00:00
Revises:
2021-04-25 00:31:15 +00:00
Create Date: 2021-04-25 01:00:49.131019
2021-04-17 22:39:43 +00:00
"""
import sqlalchemy as sa
import sqlalchemy_utils
from alembic import op
2021-04-17 22:39:43 +00:00
# revision identifiers, used by Alembic.
2021-04-25 00:31:15 +00:00
revision = 'c6aacbd5d796'
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
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'], )
)
2021-04-17 22:39:43 +00:00
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')
)
2021-04-17 22:39:43 +00:00
# ### 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 ###