phytopi/migrations/versions/5b75d2439618_.py
2019-01-31 14:49:46 +01:00

60 lines
2.2 KiB
Python

"""empty message
Revision ID: 5b75d2439618
Revises:
Create Date: 2018-10-28 15:26:30.086363
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5b75d2439618'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('camera_settings',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('iso', sa.Integer(), nullable=True),
sa.Column('fps', sa.Integer(), nullable=True),
sa.Column('width', sa.Integer(), nullable=True),
sa.Column('height', sa.Integer(), nullable=True),
sa.Column('fix_shutter', sa.Boolean(), nullable=True),
sa.Column('fix_wb', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_camera_settings_name'), 'camera_settings', ['name'], unique=True)
op.create_table('dataset',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('title', sa.String(length=64), nullable=True),
sa.Column('datetime_created', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_dataset_title'), 'dataset', ['title'], unique=False)
op.create_table('image',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('filename', sa.String(length=128), nullable=True),
sa.Column('datetime_created', sa.DateTime(), nullable=True),
sa.Column('dataset_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['dataset_id'], ['dataset.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_image_filename'), 'image', ['filename'], unique=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_image_filename'), table_name='image')
op.drop_table('image')
op.drop_index(op.f('ix_dataset_title'), table_name='dataset')
op.drop_table('dataset')
op.drop_index(op.f('ix_camera_settings_name'), table_name='camera_settings')
op.drop_table('camera_settings')
# ### end Alembic commands ###