mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
7dbbc8ba22
* Use site id instead of hostname for events * Use site id in domain status check * Revert change to tracking module * Catch more places where link generation needed updating * Rename site_id to domain * Drop hostname index from events
38 lines
704 B
Elixir
38 lines
704 B
Elixir
defmodule Plausible.Repo.Migrations.AddSiteIdToEvents do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
alter table(:events) do
|
|
add :site_id, :text
|
|
end
|
|
|
|
alter table(:sessions) do
|
|
add :site_id, :text
|
|
end
|
|
|
|
execute "UPDATE events set site_id=hostname"
|
|
execute "UPDATE sessions set site_id=hostname"
|
|
|
|
alter table(:events) do
|
|
modify :site_id, :text, null: false
|
|
end
|
|
|
|
alter table(:sessions) do
|
|
modify :site_id, :text, null: false
|
|
end
|
|
|
|
create index(:events, :site_id)
|
|
create index(:sessions, :site_id)
|
|
end
|
|
|
|
def down do
|
|
alter table(:events) do
|
|
remove :site_id
|
|
end
|
|
|
|
alter table(:sessions) do
|
|
remove :site_id
|
|
end
|
|
end
|
|
end
|