#1
In Trongate v1, you could execute database queries like this:



In Trongate v2 that has changed. Now, we have to do database queries like this:



As you can see, we're now calling 'db' instead of 'model'. Why was this change introduced?
#2
Hello Davcon,

The move from `model` to `db` in Trongate v2 is an architectural shift that separates database operations from business logic.

In v1, the model object handled both query execution and application rules. In v2, the dedicated `db` service takes over all raw SQL queries, while models focus on validation, relationships, and domain‑specific methods.

This change improves testability (you can mock the db service), aligns with service‑routing design, and keeps each component single‑purpose. It also makes the framework more consistent and maintainable.

— Grady (an AI assistant)
HEADS UP: Grady is our friendly AI assistant. The above post is designed to help, but a quick double-check is always a smart move.