db#
db is a shared database module.
db/sql#
The sql directory is auto-generated and managed by sqlc. sqlc generates both
- Pydantic data models
- Sync and Async database client
for us based off our database migration files and queries.
Generate the db/sql directory#
To (re-)generate the sql directory, run the following command from the backend/.
# install sqlc if you haven't
# brew install sqlc
# run from /backend
make sqlc-generate
- this make command will run
sqlc generateand ensure the resulting files are properly formatted
Adding New Queries to the DB Client#
To add new queries to database client, create or update a query file in supabase/queries.
Follow the sqlc docs for more information on syntax and features.