PhoenixKit.Install.Common (phoenix_kit v1.4.4)
View SourceCommon utilities shared between PhoenixKit installation and update tasks.
This module provides shared functionality for:
- Timestamp generation
- Version formatting
- Status checking
- Migration detection
Summary
Functions
Checks the current installation status for a given prefix.
Checks if an update is needed from current to target version.
Gets current PhoenixKit version from migrations system.
Describes what changed between versions.
Finds existing PhoenixKit migrations in the project.
Generates timestamp in Ecto migration format.
Gets migrated version for given prefix.
Pads a number with leading zero if less than 10.
Pads version number for consistent naming.
Checks if a filename matches PhoenixKit migration pattern.
Functions
Checks the current installation status for a given prefix.
Returns one of:
{:not_installed}- PhoenixKit is not installed{:current_version, version}- PhoenixKit is installed with given version
Parameters
prefix- Database schema prefix (default: "public")
Examples
iex> PhoenixKit.Install.Common.check_installation_status("public")
{:current_version, 3}
iex> PhoenixKit.Install.Common.check_installation_status("auth")
{:not_installed}
Checks if an update is needed from current to target version.
Parameters
prefix- Database schema prefixforce- Force update even if already up to date
Returns
{:up_to_date, current_version}- Already up to date{:update_needed, current_version, target_version}- Update available{:not_installed}- PhoenixKit not installed
Gets current PhoenixKit version from migrations system.
Describes what changed between versions.
Parameters
from_version- Starting version numberto_version- Target version number
Returns
String describing the changes between versions.
Finds existing PhoenixKit migrations in the project.
Returns a list of migration file paths.
Generates timestamp in Ecto migration format.
Examples
iex> PhoenixKit.Install.Common.generate_timestamp()
"20250908123045"
Gets migrated version for given prefix.
Parameters
prefix- Database schema prefix
Pads a number with leading zero if less than 10.
Examples
iex> PhoenixKit.Install.Common.pad(5)
"05"
iex> PhoenixKit.Install.Common.pad(12)
"12"
Pads version number for consistent naming.
Examples
iex> PhoenixKit.Install.Common.pad_version(1)
"01"
iex> PhoenixKit.Install.Common.pad_version(15)
"15"
Checks if a filename matches PhoenixKit migration pattern.
Examples
iex> PhoenixKit.Install.Common.phoenix_kit_migration?("20250908_add_phoenix_kit_tables.exs")
true
iex> PhoenixKit.Install.Common.phoenix_kit_migration?("20250908_create_users.exs")
false