analytics/priv/repo/migrations/20240528115149_migrate_site_imports.exs
ruslandoga 97e0255a2b
Wrap data migration using with_repo to ensure ClickhouseRepo is running (#4190)
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2024-06-06 09:39:14 +02:00

18 lines
358 B
Elixir

defmodule Plausible.Repo.Migrations.MigrateSiteImports do
use Plausible
use Ecto.Migration
def up do
if ce?() do
{:ok, _, _} =
Ecto.Migrator.with_repo(Plausible.ClickhouseRepo, fn _repo ->
Plausible.DataMigration.SiteImports.run(dry_run?: false)
end)
end
end
def down do
raise "Irreversible"
end
end