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

PhoenixKit V08 Migration: Username Support

This migration adds username functionality to the user system, allowing users
to have unique usernames in addition to their email addresses.

## Changes

### Username System
- Adds username field to phoenix_kit_users table
- Creates unique constraint on username field
- Migrates existing users to have default usernames based on email
- Provides username validation and generation logic

### New Features
- **Username Field**: Optional unique username for each user
- **Email-based Generation**: Automatically generates usernames from email addresses
- **Uniqueness Handling**: Handles duplicate usernames with incremental suffixes
- **Backwards Compatibility**: Existing functionality remains unchanged

## PostgreSQL Support
- Supports PostgreSQL prefix for schema isolation
- Optimized indexes for username lookups
- Safe migration of existing user data

# `down`

# `up`

Run the V08 migration to add username support.

---

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