Hex.pm VersionHex docsLicense

Data Migration

You're reading the main branch's readme. Please visit hexdocs for the latest published documentation.

View Ecto Data Migrations and run them from a Phoenix LiveDashboard page. Streams logs as the data migrations runs to the dashboard.

For example, in your Phoenix router:

live_dashboard "/my/admin/dashboard",
# must have `allow_destructive_actions: true` in order to run data migrations
# otherwise it will be view-only to see the status
allow_destructive_actions: true,
# Provide the page with Repo and migration folders config
additional_pages: [
# so the route becomes "/my/admin/dashboard/data_migrations"
data_migrations: {
DataMigration.LiveDashboard.Page,
{MyApp.PubSub, %{MyApp.Repo => ["data_migrations"]}, options}
# These paths will be passed into `Ecto.Migrator.migrations_path(repo, path)`
# `options` is optional; you may supply 2 item tuple instead to omit options
}
]

Options you may supply to the page:

Requires OTP 27+

Screenshots

Migration List

Migration Show

Migration Ran with Logs

Migration Ran with Logs and errors