<reponame>ThatOldChap/fictitious-penguin<gh_stars>1-10
"""Adjusted string field allowances

Revision ID: <KEY>
Revises: 
Create Date: 2021-09-22 22:53:52.046104

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('company',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=48), nullable=True),
    sa.Column('category', sa.String(length=24), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('project',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('number', sa.Integer(), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('test_equipment_type',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('company_projects',
    sa.Column('company_id', sa.Integer(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], )
    )
    op.create_table('job',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('stage', sa.String(length=16), nullable=True),
    sa.Column('phase', sa.String(length=16), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('test_equipment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('asset_id', sa.String(length=24), nullable=True),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('manufacturer', sa.String(length=24), nullable=True),
    sa.Column('model_num', sa.String(length=24), nullable=True),
    sa.Column('serial_num', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('first_name', sa.String(length=48), nullable=True),
    sa.Column('last_name', sa.String(length=48), nullable=True),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('token', sa.String(length=32), nullable=True),
    sa.Column('token_expiration', sa.DateTime(), nullable=True),
    sa.Column('company_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('calibration_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('calibration_date', sa.DateTime(), nullable=True),
    sa.Column('calibration_due_date', sa.DateTime(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.Column('job_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['job_id'], ['job.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('project_equipment',
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], )
    )
    op.create_table('project_members',
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    op.create_table('channel',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('measurement_type', sa.String(length=32), nullable=True),
    sa.Column('measurement_units', sa.String(length=32), nullable=True),
    sa.Column('min_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_range', sa.Float(precision=16), nullable=True),
    sa.Column('full_scale_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_error', sa.Float(precision=8), nullable=True),
    sa.Column('error_type', sa.String(length=16), nullable=True),
    sa.Column('min_injection_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_injection_range', sa.Float(precision=16), nullable=True),
    sa.Column('injection_units', sa.String(length=32), nullable=True),
    sa.Column('status', sa.String(length=32), nullable=True),
    sa.Column('interface', sa.String(length=32), nullable=True),
    sa.Column('notes', sa.String(length=128), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.Column('required_supplier_approval', sa.Boolean(), nullable=True),
    sa.Column('required_client_approval', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('approval_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('company_category', sa.String(length=16), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('channel_equipment_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('calibration_due_date', sa.DateTime(), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('channel_required_equipment',
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], )
    )
    op.create_table('testpoint',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('measured_injection_value', sa.Float(precision=16), nullable=True),
    sa.Column('nominal_injection_value', sa.Float(precision=16), nullable=True),
    sa.Column('measured_test_value', sa.Float(precision=16), nullable=True),
    sa.Column('nominal_test_value', sa.Float(precision=16), nullable=True),
    sa.Column('measured_error', sa.Float(precision=8), nullable=True),
    sa.Column('test_result', sa.String(length=12), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('testpoint')
    op.drop_table('channel_required_equipment')
    op.drop_table('channel_equipment_record')
    op.drop_table('approval_record')
    op.drop_table('channel')
    op.drop_table('project_members')
    op.drop_table('project_equipment')
    op.drop_table('group')
    op.drop_table('calibration_record')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_token'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    op.drop_table('test_equipment')
    op.drop_table('job')
    op.drop_table('company_projects')
    op.drop_table('test_equipment_type')
    op.drop_table('project')
    op.drop_table('company')
    # ### end Alembic commands ###

"""Adjusted string field allowances

Revision ID: <KEY>
Revises: 
Create Date: 2021-09-22 22:53:52.046104

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('company',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=48), nullable=True),
    sa.Column('category', sa.String(length=24), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('project',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('number', sa.Integer(), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('test_equipment_type',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('company_projects',
    sa.Column('company_id', sa.Integer(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], )
    )
    op.create_table('job',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('stage', sa.String(length=16), nullable=True),
    sa.Column('phase', sa.String(length=16), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('test_equipment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('asset_id', sa.String(length=24), nullable=True),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('manufacturer', sa.String(length=24), nullable=True),
    sa.Column('model_num', sa.String(length=24), nullable=True),
    sa.Column('serial_num', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('first_name', sa.String(length=48), nullable=True),
    sa.Column('last_name', sa.String(length=48), nullable=True),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('token', sa.String(length=32), nullable=True),
    sa.Column('token_expiration', sa.DateTime(), nullable=True),
    sa.Column('company_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('calibration_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('calibration_date', sa.DateTime(), nullable=True),
    sa.Column('calibration_due_date', sa.DateTime(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('status', sa.String(length=16), nullable=True),
    sa.Column('job_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['job_id'], ['job.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('project_equipment',
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], )
    )
    op.create_table('project_members',
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    op.create_table('channel',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('measurement_type', sa.String(length=32), nullable=True),
    sa.Column('measurement_units', sa.String(length=32), nullable=True),
    sa.Column('min_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_range', sa.Float(precision=16), nullable=True),
    sa.Column('full_scale_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_error', sa.Float(precision=8), nullable=True),
    sa.Column('error_type', sa.String(length=16), nullable=True),
    sa.Column('min_injection_range', sa.Float(precision=16), nullable=True),
    sa.Column('max_injection_range', sa.Float(precision=16), nullable=True),
    sa.Column('injection_units', sa.String(length=32), nullable=True),
    sa.Column('status', sa.String(length=32), nullable=True),
    sa.Column('interface', sa.String(length=32), nullable=True),
    sa.Column('notes', sa.String(length=128), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.Column('required_supplier_approval', sa.Boolean(), nullable=True),
    sa.Column('required_client_approval', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('approval_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('company_category', sa.String(length=16), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('channel_equipment_record',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('calibration_due_date', sa.DateTime(), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_id'], ['test_equipment.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('channel_required_equipment',
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.Column('test_equipment_type_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.ForeignKeyConstraint(['test_equipment_type_id'], ['test_equipment_type.id'], )
    )
    op.create_table('testpoint',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('last_updated', sa.DateTime(), nullable=True),
    sa.Column('measured_injection_value', sa.Float(precision=16), nullable=True),
    sa.Column('nominal_injection_value', sa.Float(precision=16), nullable=True),
    sa.Column('measured_test_value', sa.Float(precision=16), nullable=True),
    sa.Column('nominal_test_value', sa.Float(precision=16), nullable=True),
    sa.Column('measured_error', sa.Float(precision=8), nullable=True),
    sa.Column('test_result', sa.String(length=12), nullable=True),
    sa.Column('channel_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channel.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('testpoint')
    op.drop_table('channel_required_equipment')
    op.drop_table('channel_equipment_record')
    op.drop_table('approval_record')
    op.drop_table('channel')
    op.drop_table('project_members')
    op.drop_table('project_equipment')
    op.drop_table('group')
    op.drop_table('calibration_record')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_token'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    op.drop_table('test_equipment')
    op.drop_table('job')
    op.drop_table('company_projects')
    op.drop_table('test_equipment_type')
    op.drop_table('project')
    op.drop_table('company')
    # ### end Alembic commands ###
Adjusted string field allowances  Revision ID: <KEY> Revises:  Create Date: 2021-09-22 22:53:52.046104 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###