Search documentation of phoenix_kit

# PhoenixKit.Migrations.Postgres.V08 (phoenix_kit v1.6.19)

View Source

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

# Summary

## Functions

down(opts)
up(opts)

Run the V08 migration to add username support.

# Functions

# down(opts)

# up(opts)

Run the V08 migration to add username support.