university-final-iot-backend/migrations/versions/fd5cfe0f1c51_.py

41 lines
1.2 KiB
Python

"""empty message
Revision ID: fd5cfe0f1c51
Revises: 55611f1868bd
Create Date: 2018-10-08 23:07:48.054401
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fd5cfe0f1c51'
down_revision = '55611f1868bd'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('accounts', sa.Column('confirmed', sa.Boolean(), nullable=True))
op.add_column('accounts', sa.Column('confirmed_at', sa.DateTime(), nullable=True))
role = sa.table('roles', sa.column('id', sa.Integer),
sa.column('permissions', sa.ARRAY(sa.String)))
op.execute(role.update().where(role.c.id == op.inline_literal(1)).
values({'permissions':
['CREATE_DEVICE_TYPE', 'CREATE_ROLE',
'ASSIGN_ROLE',
'CREATE_DEVICE', 'CREATE_DASHBOARD',
'READ_DEVICE_TYPES', 'READ_ROLES']})
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('accounts', 'confirmed_at')
op.drop_column('accounts', 'confirmed')
# ### end Alembic commands ###