Files
shopdb-flask/plugins/notifications/migrations/versions/0002_index_businessunitid.py
Cam Proudlock a9d0dfff4a Initial import: shopdb-flask multi-site asset platform
Flask + Vue rewrite of the classic-ASP shopdb, built as a plugin
framework so sister GE Aerospace sites can adopt it. Product version
0.7.0-pre-0.8.0, plugin contract 0.11.0, 966 backend tests.

Key entry points:
- docs/INSTALL-WINDOWS-IIS.md - tested Windows + IIS install runbook
  (own-site and subpath deployment methods)
- docs/PILOT-DEPLOY.md - production pilot: stand up + import + verify
- docs/IMPORT-API.md - schema-agnostic legacy data import contract
- scripts/site_imports/wjf/ - West Jefferson reference import loader
- docs/adr/ - twelve accepted architecture decision records
2026-07-14 07:58:51 -04:00

43 lines
1.1 KiB
Python

"""Index notifications.businessunitid (shopfloor list route filters on it).
businessunitid is a soft-ref column the shopfloor feed filters by; it had no
index. Add ix_notifications_businessunitid (matches the model's index=True).
Idempotent; downgrade drops it.
Revision ID: notifications0002buidx
Revises: notifications0001anchor
"""
from alembic import op
import sqlalchemy as sa
revision = 'notifications0002buidx'
down_revision = 'notifications0001anchor'
branch_labels = None
depends_on = None
_INDEX = 'ix_notifications_businessunitid'
def _index_names(insp, table):
return {i['name'] for i in insp.get_indexes(table)}
def upgrade():
bind = op.get_bind()
insp = sa.inspect(bind)
if 'notifications' not in insp.get_table_names():
return
if _INDEX not in _index_names(insp, 'notifications'):
op.create_index(_INDEX, 'notifications', ['businessunitid'])
def downgrade():
bind = op.get_bind()
insp = sa.inspect(bind)
if 'notifications' not in insp.get_table_names():
return
if _INDEX in _index_names(insp, 'notifications'):
op.drop_index(_INDEX, table_name='notifications')