32 lines
875 B
Python
32 lines
875 B
Python
"""phase14 — add created_at to facilities
|
|
|
|
Adds a nullable DateTime column to the facilities table so that facility
|
|
creation time is tracked consistently with every other core model.
|
|
|
|
Existing rows receive NULL (unknown creation time) — nullable=True is
|
|
intentional for backward compatibility with pre-existing data.
|
|
|
|
Revision ID: phase14_facility_created_at
|
|
Revises: phase13_issue_facility
|
|
"""
|
|
|
|
revision = 'phase14_facility_created_at'
|
|
down_revision = 'phase13_issue_facility'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
def upgrade():
|
|
with op.batch_alter_table('facilities') as batch_op:
|
|
batch_op.add_column(
|
|
sa.Column('created_at', sa.DateTime(), nullable=True)
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
with op.batch_alter_table('facilities') as batch_op:
|
|
batch_op.drop_column('created_at')
|