mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
Add Purge.reset!/2
variant allowing to set arbitrary cutoff time
This commit is contained in:
parent
b2cd26b262
commit
6f294d5d58
@ -89,6 +89,7 @@ defmodule Plausible.Purge do
|
|||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec reset!(Plausible.Site.t()) :: {:ok, Plausible.Site.t()}
|
||||||
def reset!(site) do
|
def reset!(site) do
|
||||||
site
|
site
|
||||||
|> Ecto.Changeset.change(
|
|> Ecto.Changeset.change(
|
||||||
@ -97,4 +98,14 @@ defmodule Plausible.Purge do
|
|||||||
)
|
)
|
||||||
|> Plausible.Repo.update!()
|
|> Plausible.Repo.update!()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec reset!(Plausible.Site.t(), NaiveDateTime.t()) :: {:ok, Plausible.Site.t()}
|
||||||
|
def reset!(site, timestap) do
|
||||||
|
site
|
||||||
|
|> Ecto.Changeset.change(
|
||||||
|
native_stats_start_at: timestamp |> NaiveDateTime.truncate(:second),
|
||||||
|
stats_start_date: nil
|
||||||
|
)
|
||||||
|
|> Plausible.Repo.update!()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user