Documentation · Chapter 13

Prove the data layer before production.

This workshop validates SQLite locally, then repeats the essential checks against MySQL, MariaDB, or PostgreSQL before deployment.

Every lesson starts from the problem, explains the mechanism, then gives a concrete verification.

Prepare the connections

Configure main first and keep credentials outside committed files. Add a second named connection only when it represents a real responsibility.

phpaml — zsh
aml data:status --connection main
aml data:doctor --connection main --json
aml test

Exercise writes and failures

Create, update, relate, and delete records. Force one validation error and one failed transaction, then confirm that partial data was not committed.

Verify the production target

Run migrations, seeders, status, doctor, and the integration suite against the same database family and version used in production. SQLite-only success does not prove PostgreSQL or MySQL behavior.

SUMMARY

What to remember

  • Data gives persistence an explicit, reusable boundary.
  • Named connections and DbSet make reads intentional.
  • Tracking and transactions commit one coherent unit of work.
  • Relations, migrations, seeders, and diagnostics prepare real deployments.