427a491380
Add alembic_app revision 20260611_06_merge_location_poo_tables that builds empty location and poo_records tables (REAL float columns, matching the production schema and the adopt scripts' EXPECTED_*_TABLE_INFO constants). Update APP_BASELINE_REVISION to the new head. Schema-only; data migration is handled separately by scripts/migrate_legacy_data.py (M1-T02).
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""merge location and poo_records tables into app chain
|
|
|
|
Revision ID: 20260611_06_merge_location_poo_tables
|
|
Revises: 20260429_05_public_ip_monitor
|
|
Create Date: 2026-06-11 00:00:01.000000
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision: str = "20260611_06_merge_location_poo_tables"
|
|
down_revision: Union[str, None] = "20260429_05_public_ip_monitor"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"location",
|
|
sa.Column("person", sa.Text(), nullable=False),
|
|
sa.Column("datetime", sa.Text(), nullable=False),
|
|
sa.Column("latitude", sa.REAL(), nullable=False),
|
|
sa.Column("longitude", sa.REAL(), nullable=False),
|
|
sa.Column("altitude", sa.REAL(), nullable=True),
|
|
sa.PrimaryKeyConstraint("person", "datetime"),
|
|
)
|
|
|
|
op.create_table(
|
|
"poo_records",
|
|
sa.Column("timestamp", sa.Text(), nullable=False),
|
|
sa.Column("status", sa.Text(), nullable=False),
|
|
sa.Column("latitude", sa.REAL(), nullable=False),
|
|
sa.Column("longitude", sa.REAL(), nullable=False),
|
|
sa.PrimaryKeyConstraint("timestamp"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("poo_records")
|
|
op.drop_table("location")
|