SPB Git

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%
963 B · 36 lines python
Raw Blame History
1# =============================================================================2# QWHPI — Quebec Weekly Housing Price Index3# Author  : Simon-Pierre Boucher4# Contact : contact@spboucher.ai5# File    : db/migrations/versions/001_initial_schema.py6# Purpose : Initial migration — creates the full QWHPI schema (db/schema.sql).7# =============================================================================8"""Initial QWHPI schema.910Revision ID: 00111Revises:12"""1314from __future__ import annotations1516from pathlib import Path1718from alembic import op1920revision = "001"21down_revision = None22branch_labels = None23depends_on = None2425SCHEMA_SQL = Path(__file__).resolve().parents[2] / "schema.sql"262728def upgrade() -> None:29    op.execute(SCHEMA_SQL.read_text())303132def downgrade() -> None:33    for table in ("vintages", "liquidity", "observations", "model_runs",34                  "series", "geographies"):35        op.execute(f"DROP TABLE IF EXISTS {table} CASCADE")36