rmi-backend/alembic.ini
cryptorugmunch c1d1fc82ee fix(infra): wire Alembic + remove docker-restart-in-web-request
P3.1 — Alembic wiring:
- alembic.ini: was hardcoded to Supabase env vars that never resolved.
  Now uses canonical DATABASE_URL (Postgres).
- alembic/env.py: reads DATABASE_URL env var (with async->sync driver
  conversion), falls back to alembic.ini default.
- alembic/versions/0001_baseline.py: captures core tables (tokens,
  alerts, news_items, scan_reports, rag_findings, x402_receipts,
  profiles, contract_audits, badges, chat_messages) that were previously
  created via scattered CREATE TABLE IF NOT EXISTS across the codebase.
  Uses IF NOT EXISTS for idempotent re-run.
- Documented: no ORM models, so autogenerate doesn't work. All
  migrations must be hand-written: alembic revision -m ...

P4.1 — async correctness:
- oracle_manipulation_detector.py:1287 was inside async def main() with
  time.sleep(30). Wrapped in async _monitor_loop() with asyncio.sleep().
- auto_healing.py:82 was a web endpoint that ran os.system('docker
  restart rmi-redis') directly from a FastAPI request — security hole.
  Replaced with audit-logged stub that requires manual operator action.
2026-07-07 17:56:57 +07:00

39 lines
793 B
INI

[alembic]
script_location = alembic
# Use the canonical DATABASE_URL (Postgres) — was previously broken (Supabase env vars).
# Override with: DATABASE_URL=... alembic upgrade head
sqlalchemy.url = postgresql+psycopg2://rmi:rmi@localhost/rmi
file_template = %%(year)d%%(month).2d%%(day).2d_%%(hour).2d%%(minute).2d_%%(slug)s
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S