42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
|
"""empty message
|
||
|
|
||
|
Revision ID: 56ec2b819bd8
|
||
|
Revises:
|
||
|
Create Date: 2018-04-27 16:05:14.796856
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
from sqlalchemy.dialects import postgresql
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '56ec2b819bd8'
|
||
|
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 ###
|