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

PhoenixKit V36 Migration: Connections Module - Social Relationships System

Adds complete social relationships system with follows, connections, and blocking.

## Architecture

Each relationship type has two tables:
- **Main table**: Current state only (one row per user pair)
- **History table**: Activity log of all changes over time

## Changes

### User Follows Table (phoenix_kit_user_follows)
- One-way follow relationships (no consent required)
- Stores only CURRENT follows (row deleted when unfollowed)
- Unique constraint ensures one row per user pair

### User Follows History Table (phoenix_kit_user_follows_history)
- Logs all follow/unfollow events
- Actions: "follow", "unfollow"
- Preserves full audit trail

### User Connections Table (phoenix_kit_user_connections)
- Two-way mutual relationships (requires acceptance)
- Stores only CURRENT status per user pair
- Status: "pending", "accepted" (rejected rows are deleted)

### User Connections History Table (phoenix_kit_user_connections_history)
- Logs all connection events
- Actions: "requested", "accepted", "rejected", "removed"
- Preserves full audit trail

### User Blocks Table (phoenix_kit_user_blocks)
- Blocking prevents all interaction
- Stores only CURRENT blocks (row deleted when unblocked)
- Unique constraint ensures one row per user pair

### User Blocks History Table (phoenix_kit_user_blocks_history)
- Logs all block/unblock events
- Actions: "block", "unblock"
- Preserves full audit trail

## Settings

- connections_enabled: Enable/disable entire module

## Features

- UUIDv7 primary keys for time-sortable IDs
- Comprehensive indexes for efficient queries
- Foreign key constraints for data integrity
- Complete activity history for auditing

# `down`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/phoenix_kit/migrations/postgres/v36.ex#L80)

Rollback the V36 migration.

# `up`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/phoenix_kit/migrations/postgres/v36.ex#L61)

Run the V36 migration to add connections system.

---

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