Skip to content

feat: declarative database migrations with pgschema, and queries in sql files - #70

Merged
devodii merged 18 commits into
mainfrom
feat/pgschema-migrations
Nov 15, 2026
Merged

devodii merged 18 commits into
mainfrom
feat/pgschema-migrations

Conversation

@devodii

@devodii devodii commented Nov 15, 2026

Copy link
Copy Markdown
Owner
  • the schema now lives in apps/api/db/schema as one sql file per table, index, view and function, adopted from the live local database so nothing existing is dropped
  • hackproof schema plan|apply|verify wraps pgschema 1.14.1, and every plan is written to a numbered file in db/migrations as a record of what changed and why
  • apply refuses any plan that drops or rewrites data unless --allow-destructive is passed, and refuses a database that is not local unless --remote or CI is set
  • CI checks the schema against an empty database, requires a migration file when the schema changes, and migrates production when the pull request merges to main using the PRODUCTION_DATABASE_URL secret, with the host, user and password masked in the public logs
  • every query moved out of Python into src/hackproof/sql and is loaded with load_sql, linted with sqlfluff in CI, with a test that prepares every statement against the schema
  • the repeated method ranking and hacker selection became the method_rank and hackers sql functions
  • a data-sync workflow regenerates the data files from the database every six hours and opens a pull request when they drift
  • ruff, sqlfluff and a taskfile follow the shared setup from the other repos

@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hackproof Ready Ready Preview Nov 15, 2026 4:35pm UTC

Request Review

@devodii
devodii merged commit a7ee8c4 into main Nov 15, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant