Search documentation of phoenix_kit

# PhoenixKit.Migrations.Postgres.V16 (phoenix_kit v1.7.87)

Copy Markdown View Source

PhoenixKit V16 Migration: OAuth Providers System & Magic Link Registration

This migration introduces OAuth authentication support for external providers like Google, Apple, GitHub, and others using the Ueberauth framework. It also modifies the tokens table to support magic link registration.

## Changes

### OAuth Providers System

- Adds phoenix_kit_user_oauth_providers table for OAuth provider linking
- Supports multiple OAuth providers per user (Google, Apple, GitHub, etc.)
- Stores OAuth tokens with encryption support
- Account linking by email address
- Audit trail with insertion timestamps

### Magic Link Registration Support

- Allows null user_id in phoenix_kit_users_tokens for magic_link_registration context
- Adds check constraint to ensure user_id is required for non-registration contexts

### New Tables

- phoenix_kit_user_oauth_providers: OAuth provider associations with users

## PostgreSQL Support

- Supports PostgreSQL prefix for schema isolation
- Optimized indexes for performance
- Unique constraints to prevent duplicate provider links
- JSONB field for flexible OAuth data storage

## Summary

### Functions

down(opts)

Rollback the V16 migration.

up(opts)

Run the V16 migration to add OAuth providers system and magic link registration support.

## Functions

# down(opts)

Rollback the V16 migration.

# up(opts)

Run the V16 migration to add OAuth providers system and magic link registration support.