mirror of
https://github.com/plausible/analytics.git
synced 2024-09-11 09:56:02 +03:00
Add data migration cleaning up referrer source for demo site (#4225)
* Add data migration cleaning up referrer source for demo site
* Alter query string formatting out of abundance of care 😬
This commit is contained in:
parent
2c05676d8e
commit
6a511ec8a6
@ -0,0 +1,25 @@
|
||||
defmodule Plausible.DataMigration.CleanUpDemoSiteReferrerSource do
|
||||
@moduledoc """
|
||||
Clean up referrer_source entries for demo site with
|
||||
`Direct / None` for value populated by dogfooding
|
||||
Plausible stats.
|
||||
"""
|
||||
|
||||
alias Plausible.IngestRepo
|
||||
alias Plausible.Repo
|
||||
|
||||
def run(timeout \\ 60_000) do
|
||||
demo_domain = PlausibleWeb.Endpoint.host()
|
||||
%{id: demo_site_id} = Repo.get_by(Plausible.Site, domain: demo_domain)
|
||||
|
||||
for table <- ["sessions_v2", "events_v2"] do
|
||||
IngestRepo.query!(
|
||||
"ALTER TABLE {$0:Identifier} UPDATE referrer_source = '' WHERE " <>
|
||||
"site_id = {$1:UInt64} AND referrer_source = 'Direct / None'",
|
||||
[table, demo_site_id],
|
||||
settings: [mutations_sync: 1],
|
||||
timeout: timeout
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user