Isolated database branches for AI-assisted development
Agent-assisted database work needs an explicit project, branch, and permission boundary. A branch workflow helps keep experiments separate from a production target.
1. Choose the target
List the available branches and select a development or preview branch. Record its ID and configure BACKWRITE_BRANCH_ID before starting the agent. Confirm that the supplied credential permits only the intended access.
2. Inspect and test
Inspect the schema before proposing SQL. Review migration effects, obtain any required write approval, run the change on the selected branch, and test the application against that branch. Use sanitized fixtures when production data is unnecessary.
3. Generate matching application types
Generate TypeScript, Prisma, or Drizzle definitions from the updated schema. Review the generated definitions together with the migration so that code and database expectations agree.
4. Promote artifacts deliberately
The documented promotion workflow advances schema, policies, and configuration. It does not merge preview application rows into production. Inspect destructive schema changes and validate backup and rollback behavior before production promotion.
Evaluate the boundary
Check authorization with both an allowed and a denied credential. Verify the resolved branch for every tool call. Isolation does not make a destructive query safe inside its target branch.