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

42 lines
1.4 KiB
Python
Raw Normal View History

2018-04-27 08:47:24 +00:00
"""empty message
2018-05-03 14:40:30 +00:00
Revision ID: d1db8dcc190d
2018-04-27 08:47:24 +00:00
Revises:
2018-05-03 14:40:30 +00:00
Create Date: 2018-05-03 16:21:14.351605
2018-04-27 08:47:24 +00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
2018-05-03 14:40:30 +00:00
revision = 'd1db8dcc190d'
2018-04-27 08:47:24 +00:00
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('recordings',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('recorded_at', sa.DateTime(), nullable=True),
sa.Column('received_at', sa.DateTime(), nullable=True),
sa.Column('device_id', sa.Integer(), nullable=True),
2018-04-27 08:47:24 +00:00
sa.Column('record_type', sa.Integer(), nullable=False),
sa.Column('record_value', sa.String(), nullable=False),
sa.Column('raw_record', postgresql.JSON(astext_type=sa.Text()), nullable=True),
sa.PrimaryKeyConstraint('id')
2018-04-27 08:47:24 +00:00
)
op.create_index(op.f('ix_recordings_received_at'), 'recordings', ['received_at'], unique=False)
2018-04-27 08:47:24 +00:00
op.create_index(op.f('ix_recordings_recorded_at'), 'recordings', ['recorded_at'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_recordings_recorded_at'), table_name='recordings')
op.drop_index(op.f('ix_recordings_received_at'), table_name='recordings')
2018-04-27 08:47:24 +00:00
op.drop_table('recordings')
# ### end Alembic commands ###