39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
|
"""empty message
|
||
|
|
||
|
Revision ID: 33133bc3ce1d
|
||
|
Revises:
|
||
|
Create Date: 2018-04-27 10:45:32.919141
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
from sqlalchemy.dialects import postgresql
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '33133bc3ce1d'
|
||
|
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=False),
|
||
|
sa.Column('device_id', sa.Integer(), nullable=False),
|
||
|
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', 'recorded_at', 'device_id')
|
||
|
)
|
||
|
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_table('recordings')
|
||
|
# ### end Alembic commands ###
|