blog/migrations/versions/d08a068031c3_001.py
2020-07-08 14:36:13 +02:00

74 lines
2.6 KiB
Python

"""001
Revision ID: d08a068031c3
Revises:
Create Date: 2020-07-08 11:48:15.369556
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd08a068031c3'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('role',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.Unicode(), nullable=True),
sa.Column('name', sa.Unicode(), nullable=True),
sa.Column('description', sa.Unicode(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_role_uuid'), 'role', ['uuid'], unique=False)
op.create_table('task',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(), nullable=True),
sa.Column('uuid', sa.Unicode(), nullable=True),
sa.Column('status', sa.Unicode(), nullable=True),
sa.Column('func_name', sa.Unicode(), nullable=True),
sa.Column('args', sa.Unicode(), nullable=True),
sa.Column('kwargs', sa.Unicode(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.Unicode(), nullable=True),
sa.Column('email', sa.Unicode(), nullable=True),
sa.Column('password', sa.Unicode(), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.Column('confirmed_at', sa.DateTime(), nullable=True),
sa.Column('timezone', sa.String(), nullable=True),
sa.Column('tz_offset_seconds', sa.Integer(), nullable=True),
sa.Column('locale', sa.String(length=4), nullable=True),
sa.Column('name', sa.Unicode(), nullable=True),
sa.Column('profile_image_url', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
op.create_index(op.f('ix_user_uuid'), 'user', ['uuid'], unique=False)
op.create_table('roles_users',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('roles_users')
op.drop_index(op.f('ix_user_uuid'), table_name='user')
op.drop_table('user')
op.drop_table('task')
op.drop_index(op.f('ix_role_uuid'), table_name='role')
op.drop_table('role')
# ### end Alembic commands ###