Skip to content

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

Create `site_user_preferences` table and apply LV fix (#3506)

Adrian Gruntkowski8698b8770bfe
diff --git a/lib/plausible_web/live/sites.ex b/lib/plausible_web/live/sites.ex
index 5237d8f70d..29d4dc6e18 100644
--- a/lib/plausible_web/live/sites.ex
+++ b/lib/plausible_web/live/sites.ex
@@ -474,6 +474,14 @@ defmodule PlausibleWeb.Live.Sites do
"""
end
+ def handle_event(
+ "filter",
+ %{"filter_text" => filter_text},
+ %{assigns: %{filter_text: filter_text}} = socket
+ ) do
+ {:noreply, socket}
+ end
+
def handle_event("filter", %{"filter_text" => filter_text}, socket) do
socket =
socket
diff --git a/priv/repo/migrations/20231109090334_add_site_user_preferences.exs b/priv/repo/migrations/20231109090334_add_site_user_preferences.exs
new file mode 100644
index 0000000000..aa63694c01
--- /dev/null
+++ b/priv/repo/migrations/20231109090334_add_site_user_preferences.exs
@@ -0,0 +1,14 @@
+defmodule Plausible.Repo.Migrations.AddSiteUserPreferences do
+ use Ecto.Migration
+
+ def change do
+ create table(:site_user_preferences) do
+ add :pinned_at, :naive_datetime
+ add :user_id, references(:users, on_delete: :delete_all), null: false
+ add :site_id, references(:sites, on_delete: :delete_all), null: false
+ timestamps()
+ end
+
+ create unique_index(:site_user_preferences, [:user_id, :site_id])
+ end
+end