Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

skip v1 table drop in self-host (#2945)

ruslandogaf489d96251c5
diff --git a/priv/ingest_repo/migrations/20230509124919_clean_up_old_tables_after_v2_migration.exs b/priv/ingest_repo/migrations/20230509124919_clean_up_old_tables_after_v2_migration.exs
index b68b8977a1..9102767bd9 100644
--- a/priv/ingest_repo/migrations/20230509124919_clean_up_old_tables_after_v2_migration.exs
+++ b/priv/ingest_repo/migrations/20230509124919_clean_up_old_tables_after_v2_migration.exs
@@ -2,7 +2,11 @@ defmodule Plausible.IngestRepo.Migrations.CleanUpOldTablesAfterV2Migration do
use Ecto.Migration
def change do
- drop_if_exists table(:events)
- drop_if_exists table(:sessions)
+ selfhost? = Application.fetch_env!(:plausible, :is_selfhost)
+
+ unless selfhost? do
+ drop_if_exists table(:events)
+ drop_if_exists table(:sessions)
+ end
end
end