add migration
This commit is contained in:
parent
bbdadec1bc
commit
ac0d99281e
@ -0,0 +1,96 @@
|
||||
"""add_fat_test
|
||||
|
||||
Revision ID: 49f175ff56cb
|
||||
Revises: 43fa78bc3b7d
|
||||
Create Date: 2024-11-05 03:26:22.578321
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import models as models
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '49f175ff56cb'
|
||||
down_revision = '01d6889832f7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('component_failure',
|
||||
sa.Column('FailureID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('Date', sa.Date(), nullable=False),
|
||||
sa.Column('Component', sa.String(length=255), nullable=False),
|
||||
sa.Column('FailureMode', sa.String(length=255), nullable=False),
|
||||
sa.Column('Cause', sa.String(length=255), nullable=False),
|
||||
sa.Column('RepairAction', sa.Text(), nullable=True),
|
||||
sa.Column('Technician', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('FailureID', name=op.f('component_failure_pkey')),
|
||||
sa.UniqueConstraint('Date', 'Component', 'FailureMode', 'Cause', 'Technician', name='unique_failure_entry')
|
||||
)
|
||||
op.create_table('component_failure_stats',
|
||||
sa.Column('StatID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('Component', sa.String(length=255), nullable=False),
|
||||
sa.Column('FailureMode', sa.String(length=255), nullable=False),
|
||||
sa.Column('Cause', sa.String(length=255), nullable=False),
|
||||
sa.Column('PossibleAction', sa.Text(), nullable=True),
|
||||
sa.Column('Probability', sa.Float(), nullable=False),
|
||||
sa.Column('MTBF', sa.Float(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('StatID', name=op.f('component_failure_stats_pkey'))
|
||||
)
|
||||
op.create_table('incident_data',
|
||||
sa.Column('IncidentID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('IncidentDescription', sa.Text(), nullable=False),
|
||||
sa.Column('IncidentDate', sa.Date(), nullable=False),
|
||||
sa.Column('Consequences', sa.Text(), nullable=True),
|
||||
sa.Column('ResponseActions', sa.Text(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('IncidentID', name=op.f('incident_data_pkey'))
|
||||
)
|
||||
op.create_table('maintenance',
|
||||
sa.Column('MaintenanceID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('MaintenanceType', sa.String(length=255), nullable=False),
|
||||
sa.Column('MaintenanceDate', sa.Date(), nullable=False),
|
||||
sa.Column('ServiceDescription', sa.Text(), nullable=True),
|
||||
sa.Column('PartsReplaced', sa.Text(), nullable=True),
|
||||
sa.Column('Technician', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('MaintenanceID', name=op.f('maintenance_pkey'))
|
||||
)
|
||||
op.create_table('operational_data',
|
||||
sa.Column('OperationID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('CraneUsage', sa.Integer(), nullable=False),
|
||||
sa.Column('LoadWeight', sa.Float(), nullable=False),
|
||||
sa.Column('LoadFrequency', sa.Integer(), nullable=False),
|
||||
sa.Column('EnvironmentalConditions', sa.Text(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('OperationID', name=op.f('operational_data_pkey'))
|
||||
)
|
||||
op.create_table('reliability_data',
|
||||
sa.Column('ComponentID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('ComponentName', sa.String(length=255), nullable=False),
|
||||
sa.Column('MTBF', sa.Float(), nullable=False),
|
||||
sa.Column('FailureRate', sa.Float(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('ComponentID', name=op.f('reliability_data_pkey'))
|
||||
)
|
||||
op.create_table('safety_data',
|
||||
sa.Column('SafetyID', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('SafetyInspectionDate', sa.Date(), nullable=False),
|
||||
sa.Column('SafetyFindings', sa.Text(), nullable=True),
|
||||
sa.Column('SafetyIncidentDescription', sa.Text(), nullable=True),
|
||||
sa.Column('ComplianceStatus', sa.String(length=50), nullable=False),
|
||||
sa.PrimaryKeyConstraint('SafetyID', name=op.f('safety_data_pkey'))
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('safety_data')
|
||||
op.drop_table('reliability_data')
|
||||
op.drop_table('operational_data')
|
||||
op.drop_table('maintenance')
|
||||
op.drop_table('incident_data')
|
||||
op.drop_table('component_failure_stats')
|
||||
op.drop_table('component_failure')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user