PhoenixKit.Migrations.Postgres.V11 (phoenix_kit v1.6.16)

View Source

PhoenixKit V11 Migration: Per-User Timezone Settings

This migration adds individual timezone preferences for each user, separate from the global system timezone setting. This allows personalized date/time formatting in admin interfaces and user experiences.

Changes

User Timezone Column

  • Adds user_timezone column to phoenix_kit_users table
  • Stores timezone offset as string (e.g., "-5", "0", "+8")
  • Nullable field with fallback to system timezone setting
  • Validates timezone range (-12 to +12)

New Features

  • Personal Timezone Preferences: Each user can set their own timezone
  • Admin Dashboard Enhancement: Dates formatted per user's timezone
  • Fallback System: User timezone → System timezone → UTC
  • Backward Compatible: Existing users default to system timezone
  • Settings Integration: Seamless integration with existing settings UI

PostgreSQL Support

  • Supports PostgreSQL prefix for schema isolation
  • Uses string type for timezone offset storage (consistent with global setting)
  • No additional indexes needed (lightweight personal preference)
  • Safe nullable field addition (no data migration required)

Summary

Functions

Rollback the V11 migration.

Run the V11 migration to add per-user timezone settings.

Functions

down(opts)

Rollback the V11 migration.

up(opts)

Run the V11 migration to add per-user timezone settings.