Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move site imports migration to clickhouse repo #4316

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
defmodule Plausible.IngestRepo.Migrations.MigrateSiteImports do
use Ecto.Migration

def up do
if Plausible.ce?() do
Ecto.Migrator.with_repo(Plausible.Repo, fn _repo ->
%Postgrex.Result{rows: rows} =
Plausible.Repo.query!(
"select inserted_at from schema_migrations where version=20240528115149"
)

case rows do
[[already_ran_at]] ->
IO.puts(
"skipping site_imports migration since it has already been run at #{already_ran_at}"
)

nil

[] ->
{:ok, _, _} =
Ecto.Migrator.with_repo(Plausible.ClickhouseRepo, fn _repo ->
Plausible.DataMigration.SiteImports.run(dry_run?: false)
end)
end
end)
end
end

def down do
raise "Irreversible"
end
end
17 changes: 0 additions & 17 deletions priv/repo/migrations/20240528115149_migrate_site_imports.exs

This file was deleted.