View Source Plausible.Site.Domain (Plausible v0.0.1)

Basic interface for domain changes.

Once Plausible.DataMigration.NumericIDs schema migration is ready, domain change operation will be enabled, accessible to the users.

We will set a transition period of 72 hours during which, both old and new domains, will be accepted as traffic identifiers to the same site.

A periodic worker will call the expire/0 function to end it where applicable. See: Plausible.Workers.ExpireDomainChangeTransitions.

The underlying changeset for domain change (see: Plausible.Site) relies on database trigger installed via Plausible.Repo.Migrations.AllowDomainChange Postgres migration. The trigger checks if either domain or domain_changed_from exist to ensure unicity.

Link to this section Summary

Link to this section Functions

Link to this function

change(site, new_domain, opts \\ [])

View Source
@spec change(Plausible.Site.t(), String.t(), Keyword.t()) ::
  {:ok, Plausible.Site.t()} | {:error, Ecto.Changeset.t()}
Link to this function

expire_change_transitions(expire_threshold_hours \\ 72)

View Source
@spec expire_change_transitions(integer()) :: {:ok, non_neg_integer()}