- backend/alembic/* — alembic infra (env.py, script.py.mako). versions/ empty for now; first migration goes in Stage 2a when models are finalized. - backend/Dockerfile: bake alembic.ini + alembic/ into the image so `docker compose exec backend alembic upgrade head` works in prod. - backend/db/init/99_drop_unused_extensions.sql + bind-mount in both compose files: drops postgis-image's TIGER/topology/fuzzystrmatch on fresh volumes. - .pre-commit-config.yaml + pre-commit in dev deps: ruff/prettier on commit to stop CI failures like UP035 from leaking out. - ops/backup.sh, ops/restore.sh: pg_dump cron script with optional Selectel S3 upload. 7-day local retention. Restore guard: requires RESTORE_CONFIRM=yes. - Makefile: new targets `make migration NAME=...`, `make pre-commit-install`. - backend/.env.example: SENTRY_DSN comment with sentry.io reference.
23 lines
1,006 B
SQL
23 lines
1,006 B
SQL
-- Drops postgis-image extras that we don't use.
|
|
--
|
|
-- The postgis/postgis:16-3.4 base image's own init (10_postgis.sh) installs:
|
|
-- postgis, postgis_topology, fuzzystrmatch, postgis_tiger_geocoder
|
|
--
|
|
-- We only need `postgis` proper. The TIGER geocoder is a US Census Bureau dataset
|
|
-- (~35 tables, ~10 MB) that's irrelevant for РФ-region work. Topology and
|
|
-- fuzzystrmatch are unused too.
|
|
--
|
|
-- This script lives in /docker-entrypoint-initdb.d/ and runs ONCE on a fresh
|
|
-- volume, alphabetically AFTER 10_postgis.sh — so it sees a fully-extended DB
|
|
-- and trims the parts we don't need.
|
|
--
|
|
-- IF EXISTS + CASCADE: idempotent, won't fail if extension is already gone.
|
|
|
|
DROP EXTENSION IF EXISTS postgis_tiger_geocoder CASCADE;
|
|
DROP EXTENSION IF EXISTS postgis_topology CASCADE;
|
|
DROP EXTENSION IF EXISTS fuzzystrmatch CASCADE;
|
|
|
|
-- Empty schemas the dropped extensions left behind.
|
|
DROP SCHEMA IF EXISTS tiger CASCADE;
|
|
DROP SCHEMA IF EXISTS tiger_data CASCADE;
|
|
DROP SCHEMA IF EXISTS topology CASCADE;
|