PhoenixKit.Migrations.Postgres.V16 (phoenix_kit v1.5.2)

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
  • 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

Rollback the V16 migration.

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.