Create site_user_preferences table and apply LV fix (#3506)

* Create `site_user_preferences` table

* Do not trigger querying on filter text change when there's no change
This commit is contained in:
Adrian Gruntkowski 2023-11-09 12:24:41 +01:00 committed by GitHub
parent 69d21d59b1
commit 8698b8770b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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