analytics/priv/repo/migrations/20191010031425_add_property_to_google_auth.exs
2019-10-10 12:12:15 +08:00

20 lines
459 B
Elixir

defmodule Plausible.Repo.Migrations.AddPropertyToGoogleAuth do
use Ecto.Migration
use Plausible.Repo
def change do
alter table(:google_auth) do
add :property, :text
end
flush()
for auth <- Repo.all(Plausible.Site.GoogleAuth) do
auth = Repo.preload(auth, :site)
property = "https://#{auth.site.domain}"
Plausible.Site.GoogleAuth.set_property(auth, %{property: property})
|> Repo.update!
end
end
end