The pattern
ardent branch create prints a Postgres URL for the new branch. If you need it again, run ardent branch info regression-run (or ardent branch info when that branch is already checked out).
Most apps and test runners read the DB from an environment variable. The usual name is DATABASE_URL; Django, SQLAlchemy, Prisma, and many pytest setups are already wired for that in dev, but yours might use something else (for example PGURL or a .env file you load before running tests).
DATABASE_URL='…' npm test sets the variable only for that one process, which is why it looked as if the URL and npm test had to share a line. That is valid shell, but export and a separate test command are easier to read and match how most people run pytest or rerun commands.
In CI: create the branch in the job, assign the URL to DATABASE_URL (or wire it into your framework), run your test command, then delete the branch. See CI / CD for a GitHub Actions–shaped example.
What this unlocks
- Migration safety: run
ALTER TABLE,DROP COLUMN, schema changes against real data before you ship - Destructive queries:
DELETE,TRUNCATE, bulk updates; test the blast radius safely - Index validation: try a new index and see if it actually speeds up your real queries
- Data-dependent bugs: catch edge cases that only exist in production data, not fixtures