HomeMigrations

Migrations

Migrating raw SQL to the repository pattern

Raw SQL spread across controllers is hard to test and migrate. ArchSteer enforces that queries live in a repository layer and steers agents to the pattern.

Find the scattered SQL

ArchSteer maps every data-access point and flags raw SQL outside the repository layer.

Steer to the pattern

Agents are told to wrap queries in repositories under src/repositories and depend on them, never on a DB driver.

Converge with the ratchet

Net-new raw SQL is blocked while existing queries migrate, with progress tracked per rule.

Try it on your repo

Run `archsteer xray` on your repo to see this in under a minute, then declare intent when you're ready to govern.

FAQ

Does this assume a specific ORM?

No — the repository layer can wrap raw SQL, an ORM, or a query builder; ArchSteer enforces the boundary.

Can controllers keep their queries temporarily?

Yes — existing ones are baselined; only new violations are blocked.

Related