university-final-iot-backend/migrations/versions/6b444e5e2eef_.py

39 lines
949 B
Python

"""empty message
Revision ID: 6b444e5e2eef
Revises: c580745330a9
Create Date: 2018-05-08 11:16:27.441468
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6b444e5e2eef'
down_revision = 'c580745330a9'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('devices', 'device_type', new_column_name='device_type_id')
device_types_table = sa.Table('device_types', sa.MetaData(),
sa.Column('id', sa.Integer),
sa.Column('name', sa.String))
op.bulk_insert(device_types_table,
[
{'id':1, 'name':'REGULAR'}
]
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('devices', 'device_type_id', new_column_name='device_type')
# ### end Alembic commands ###