# `mix phoenix_kit.update`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.102/lib/mix/tasks/phoenix_kit.update.ex#L3)

Igniter-based updater for PhoenixKit.

This task handles updating an existing PhoenixKit installation to the latest version
by creating upgrade migrations that preserve existing data while adding new features.

## Two-Pass Update Strategy

To prevent configuration timing issues, the update process uses a two-pass strategy:

1. **First Pass** (if configuration is missing): Adds required configuration (e.g.,
   Ueberauth settings) via Igniter and prompts you to run the command again.

2. **Second Pass** (configuration present): Safely starts the application and
   completes the update process.

This ensures that the application always starts with all required configuration
present, avoiding runtime errors from missing dependencies.

## Automatic Updates

The update process also automatically:
- Updates CSS configuration (enables daisyUI themes if disabled)
- Rebuilds assets using the Phoenix asset pipeline
- Applies database migrations (with optional interactive prompt)

## Usage

    $ mix phoenix_kit.update
    $ mix phoenix_kit.update --prefix=myapp
    $ mix phoenix_kit.update --status
    $ mix phoenix_kit.update --skip-assets
    $ mix phoenix_kit.update -y

## Options

  * `--prefix` - Database schema prefix (default: "public")
  * `--status` - Show current installation status and available updates
  * `--force` - Force update even if already up to date
  * `--skip-assets` - Skip automatic asset rebuild check
  * `--yes` / `-y` - Skip confirmation prompts and run migrations automatically

## Examples

    # Update PhoenixKit to latest version
    mix phoenix_kit.update

    # Check what version is installed and what updates are available
    mix phoenix_kit.update --status

    # Update with custom schema prefix
    mix phoenix_kit.update --prefix=auth

    # Update without prompts (useful for CI/CD)
    mix phoenix_kit.update -y

    # Force update with automatic migration
    mix phoenix_kit.update --force -y

## Version Management

PhoenixKit uses a versioned migration system. Each version contains specific
database schema changes that can be applied incrementally.

Current version: V17 (latest version with comprehensive features)
- V01: Basic authentication with role system
- V02: Remove is_active column from role assignments (direct deletion)
- V03-V17: Additional features and improvements (see migration files for details)

## Safe Updates

All PhoenixKit updates are designed to be:
- Non-destructive (existing data is preserved)
- Backward compatible (existing code continues to work)
- Idempotent (safe to run multiple times)
- Rollback-capable (can be reverted if needed)

---

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