mirror of
https://github.com/plausible/analytics.git
synced 2024-11-27 09:16:25 +03:00
24 lines
508 B
Elixir
24 lines
508 B
Elixir
defmodule Plausible.Repo.Migrations.AddNativeStatsStartDate do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
alter table(:sites) do
|
|
add :native_stats_start_at, :naive_datetime, null: true
|
|
end
|
|
|
|
execute """
|
|
UPDATE sites SET native_stats_start_at = inserted_at
|
|
"""
|
|
|
|
alter table(:sites) do
|
|
modify :native_stats_start_at, :naive_datetime, null: false, default: fragment("now()")
|
|
end
|
|
end
|
|
|
|
def down do
|
|
alter table(:sites) do
|
|
remove :native_stats_start_at
|
|
end
|
|
end
|
|
end
|