mirror of
https://github.com/plausible/analytics.git
synced 2024-12-26 02:55:02 +03:00
cc769dfb3d
* Update Goal schema
* Equip ComboBox with the ability of JS selection callbacks
* Update factory so display_name is always present
* Extend Goals context interface
* Update seeds
Also farming unsuspecting BEAM programmers for better
sample page paths :)
* Update ComboBox test
* Unify error message color class with helpers seen elsewhere
* Use goal.display_name where applicable
* Implement LiveView extensions for editing goals
* Sprinkle display name in external stats controller tests
* Format
* Fix goal list mobile view
* Update lib/plausible_web/live/goal_settings/list.ex
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* Update lib/plausible_web/live/goal_settings/form.ex
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* Update the APIs: plugins and external
* Update test so the intent is clearer
* Format
* Update CHANGELOG
* Simplify form tabs tests
* Revert "Format"
This reverts commit c1647b5307
.
* Fixup format commit that went too far
* ComboBox: select the input contents on first focus
* Update lib/plausible/goal/schema.ex
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Update lib/plausible/goals/goals.ex
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Update lib/plausible_web/live/goal_settings/form.ex
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Pass form goal instead of just ID
* Make tab component dumber
* Extract separate render functions for edit and create forms
* Update test to account for extracted forms
* Inline goal get query
* Extract revenue goal settings to a component and avoid computing assigns in flight
* Make LV modal preload optional
* Disable preload for goal settings form modal
* Get rid of phash component ID hack
* For another render after render_submit when testing goal updates
* Fix LV preload option
* Enable preload back for goals modal for now
* Make formatter happy
* Implement support for preopening of LV modal
* Preopen goals modal to avoid feedback gap on loading edited goal
* Remove `console.log` call from modal JS
* Clean up display name input IDs
* Make revenue settings functional on first edit again
* Display names: 2nd stage migration
* Update migration with data backfill
---------
Co-authored-by: Artur Pata <artur.pata@gmail.com>
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
38 lines
733 B
Elixir
38 lines
733 B
Elixir
defmodule Plausible.Repo.Migrations.MakeGoalDisplayNamesUnique do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
fill_display_names()
|
|
|
|
alter table(:goals) do
|
|
modify :display_name, :text, null: false
|
|
end
|
|
|
|
create unique_index(:goals, [:site_id, :display_name])
|
|
end
|
|
|
|
def down do
|
|
drop unique_index(:goals, [:site_id, :display_name])
|
|
|
|
alter table(:goals) do
|
|
modify :display_name, :text, null: true
|
|
end
|
|
|
|
execute """
|
|
UPDATE goals
|
|
SET display_name = NULL
|
|
"""
|
|
end
|
|
|
|
def fill_display_names do
|
|
execute """
|
|
UPDATE goals
|
|
SET display_name =
|
|
CASE
|
|
WHEN page_path IS NOT NULL THEN 'Visit ' || page_path
|
|
WHEN event_name IS NOT NULL THEN event_name
|
|
END
|
|
"""
|
|
end
|
|
end
|