Database
Two tools, db_query and db_exec, let the agent read and write the app’s own SQLite database, one SQL statement per call; this is the running app’s real data and it has no backup.
The database is created on the first deploy. The schema lives in app/**/*.table.ts. The dashboard’s Database tab shows the same data.
Shared parameters
project.sql: one SQLite statement, with?placeholders for values. Syntax: sqlite.org/lang.html .args: the values for the placeholders, in order (strings, numbers, booleans ornull).
db_query
Runs one read-only statement: SELECT, WITH … SELECT, EXPLAIN or a read PRAGMA.
- Returns:
rows, at most 200. Text values over 2 KB are cut and the result sayscellsClipped; page withLIMIT/OFFSETor select fewer columns. A project that was never deployed returns an empty list with a note. - When the agent calls it: after a deploy, to confirm a flow wrote the right data, or before a write to see which rows it will touch.
db_exec
Runs one write statement: INSERT, UPDATE, DELETE, REPLACE, CREATE, ALTER, DROP. Full tool set only.
- Returns:
affected_row_count,last_insert_rowid, androwswhen the statement returns any. - When the agent calls it: to fix a few rows, or to copy data while renaming a column.
One statement per call. A read sent to db_exec returns NOT_A_WRITE; a write sent to db_query returns READ_ONLY. manh.run’s internal tables (ft_*, sqlite_*) can’t be written.
Don’t change a user’s role with SQL. The first admin is you: you sign up from the preview in the dashboard and become admin. The agent tries each role with test accounts, see Testing.
db_exec has no backup and no undo. Before an UPDATE or DELETE, the agent reads the rows its WHERE matches and counts them. It never writes without a WHERE. Dropping or renaming a table or column that holds data, or changing many rows at once, needs your go-ahead first.
The /directory URL has no db_exec. Data is changed through the app’s API or the Database tab.
Next steps
- Database: tables, repositories and the schema.
- Deploy your app: how the schema changes on deploy.
- Logs: what a request did to the data.