Skip to content

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

add migration (#3590)

RobertJoonas7212d336ae0c
diff --git a/priv/repo/migrations/20231204151831_backfill_last_bill_date_to_subscriptions.exs b/priv/repo/migrations/20231204151831_backfill_last_bill_date_to_subscriptions.exs
new file mode 100644
index 0000000000..13dcd7b139
--- /dev/null
+++ b/priv/repo/migrations/20231204151831_backfill_last_bill_date_to_subscriptions.exs
@@ -0,0 +1,11 @@
+defmodule Plausible.Repo.Migrations.BackfillLastBillDateToSubscriptions do
+ use Ecto.Migration
+
+ def change do
+ execute """
+ UPDATE subscriptions
+ SET last_bill_date = inserted_at::date
+ WHERE last_bill_date IS NULL AND paddle_plan_id != 'free_10k';
+ """
+ end
+end