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

42 lines
1.4 KiB
Python

"""empty message
Revision ID: d1db8dcc190d
Revises:
Create Date: 2018-05-03 16:21:14.351605
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd1db8dcc190d'
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),
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')
)
op.create_index(op.f('ix_recordings_received_at'), 'recordings', ['received_at'], unique=False)
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')
op.drop_table('recordings')
# ### end Alembic commands ###