# `data.store_required`

An entity names no database to live in, and the app declares databases but none called `main`.

Area 5, [Entities, stores and migrations](/docs/data.md); not declinable; the next step is usually the human's.

## Why Jadpo refuses it

An entity lives in the `main` database unless its file says
`store: <connection>`. With no database declared, `main` is a PostgreSQL
database you don't have to declare. Once `app.jadpo` declares databases of
its own, `main` is no longer implied, so an entity that names no store has
nowhere to go.

Jadpo won't pick one of your databases for the entity, because that
decides where its records are kept.

## What it looks like

`app.jadpo` declares one database, `archive`:


domains/notes/entities/note.jadpo:

```jadpo
entity Note {
    id: Uuid
}
```

```text
error: `Note` names no store, and there is no `main`
 --> domains/notes/entities/note.jadpo:1:8
  |
1 | entity Note {
  |        ^^^^ which store?
  reason: An entity lives in `main` unless its file says `store: <connection>`, and `app.jadpo` declares no database called `main`; its databases are `archive`.
  next: Add `store: archive` to `Note` (human)
  rule: data.store_required
  help: https://jadpo.dev/docs/errors/data.store_required

check failed: 1 error, 2 files
```

`(human)` at the end of the `next:` line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides which database keeps notes.

## How to fix it

**If notes belong in `archive`**, say so in the entity.
`domains/notes/entities/note.jadpo` becomes:

```jadpo
entity Note {
    id: Uuid

    store: archive
}
```


Notes are kept in the `archive` database.

**If notes belong in a database of their own**, declare `main` beside
`archive` in `app.jadpo`:

```jadpo
        main: {
            driver: Driver.postgres
        }
```



Notes, and every other entity that names no store, are kept in `main`.

## Related

- [Stores](/docs/stores.md)
