# `PhoenixKit.Migrations.Postgres.V104`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit/migrations/postgres/v104.ex#L1)

V104: Per-user notifications driven by the activity feed.

Creates `phoenix_kit_notifications` — one row per (activity, recipient_user)
with independent `seen_at` / `dismissed_at` timestamps. Generated in fan-out
fashion by `PhoenixKit.Notifications.maybe_create_from_activity/1` whenever an
activity targets a user other than the actor.

## Schema

- `uuid`            — UUIDv7 primary key
- `activity_uuid`   — FK → `phoenix_kit_activities` (ON DELETE CASCADE)
- `recipient_uuid`  — FK → `phoenix_kit_users`      (ON DELETE CASCADE)
- `seen_at`         — `NULL` = unread; set when the user clicks the row or
                      uses "Mark all as seen"
- `dismissed_at`    — `NULL` = still visible; set when the user dismisses
- `inserted_at`     — creation timestamp (no `updated_at`)

## Indexes

- Unique (`activity_uuid`, `recipient_uuid`) — one notification per activity
  per recipient
- Partial (`recipient_uuid`, `inserted_at`) WHERE `dismissed_at IS NULL` —
  covers the main "my undismissed inbox, newest first" read path

All operations are idempotent.

# `down`

# `up`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
