drizzle/add-query
Source
Usage
bash
npm exec saf-workflow kickoff drizzle/add-query <path>
To run this workflow automatically, tell the agent to:
- Navigate to the target package
- Run this command
- Follow the instructions until done
Checklist
When run, the workflow will:
- Copy template files and rename placeholders.
- Check if
/queries/example-table/index.ts
exists. If it doesn't exist, create it. - Update
/queries/example-table/index.ts
to include the new query. - Update the package's
index.ts
to export the query collection if it doesn't already. - Add any new parameter or result types needed for
exampleQuery
to the maintypes.ts
file. - Add any error types the query will return to the main
errors.ts
file. - Review documentation: 03-queries.md
- Implement the
exampleQuery
query following the documentation guidelines. - Review documentation: 04-testing.md
- Implement
example-query.test.ts
. - Run example-query.test.ts, make sure it passes.
- Run
npm run typecheck
Help Docs
bash
Usage: saf-workflow kickoff drizzle/add-query [options] <path>
Add a new query to a database built off the drizzle-sqlite3 package.
Arguments:
path Path of the new query (e.g. 'queries/contacts/get-by-id')
Options:
-h, --help display help for command