spb/qwhpi Public
QHPI — Quebec Housing Price Index: quality-adjusted, hierarchically pooled housing price indexes.
Python 63.9%
TypeScript 25.4%
CSS 5.5%
TeX 3.5%
SQL 0.8%
Makefile 0.5%
Dockerfile 0.5%
1# =============================================================================2# QWHPI — Quebec Weekly Housing Price Index3# Author : Simon-Pierre Boucher4# Contact : contact@spboucher.ai5# File : db/migrations/env.py6# Purpose : Alembic environment — runs SQL migrations against DATABASE_URL.7# =============================================================================8"""Alembic migration environment (offline + online modes)."""910from __future__ import annotations1112import os1314from alembic import context15from sqlalchemy import create_engine1617url = os.environ.get("DATABASE_URL", "postgresql://qwhpi:qwhpi@localhost:5432/qwhpi")181920def run_migrations_offline() -> None:21 context.configure(url=url, literal_binds=True)22 with context.begin_transaction():23 context.run_migrations()242526def run_migrations_online() -> None:27 engine = create_engine(url)28 with engine.connect() as connection:29 context.configure(connection=connection)30 with context.begin_transaction():31 context.run_migrations()323334if context.is_offline_mode():35 run_migrations_offline()36else:37 run_migrations_online()38