# Map every place that writes to the database

Prompt · Writes and ingestion · PG05

Several jobs, functions, APIs or agents change the same data, or nobody is sure who owns it.

## Prompt

```text
Map the actual write paths for the important tables in this application. Identify every script, job, API, function, trigger and agent that can create, update or delete their records. Show who owns each field, which paths overlap, and where two writers can disagree or overwrite each other. Recommend the simplest ownership model supported by the existing system.
```

**What it returns:** A map from each writer to its tables and columns, then to triggers, side effects and consumers, with the cases where writers overlap or conflict.

**Skip it when:** One code path writes each table.

**Avoid:** Treating every extra writer as wrong. Find the paths that actually conflict.

**Tools:** Repository and read-only database access.

**Works on:** Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.

**Changes:** Changes nothing

**Sessions:** Look first, then fix in a new session

## Related

- [Two systems that disagree](https://www.atlasscope.dev/prompts/two-systems-that-disagree): Finds data kept in two places (a saved copy and a table, the browser and the server) that can quietly disagree.
- [Updates that overwrite each other](https://www.atlasscope.dev/prompts/updates-that-overwrite-each-other): Finds updates that overwrite newer data because two things wrote at once.
- [Stop rewriting data that hasn't changed](https://www.atlasscope.dev/prompts/stop-rewriting-data-that-hasnt-changed): Upserts and updates run at high volume, imports are costly, or vacuum and write-ahead log churn look high.
- [Find where write logic should live](https://www.atlasscope.dev/prompts/find-where-write-logic-should-live): Business rules are split across SQL, triggers, edge functions, server routes and workers.

Source: https://www.atlasscope.dev/prompts/map-every-place-that-writes-to-the-database
