mirror of
https://github.com/plausible/analytics.git
synced 2024-12-26 02:55:02 +03:00
3dce3142bf
priv/repo/migrations/20230417095029_init_funnels.exs - restored from: aa59adeb wip 4d039ba2 Make funnel names unique 4f3216b3 Unique steps e55edf8e Rename funnel_goals->funnel_steps 34ceb3f5 dirty wip
22 lines
651 B
Elixir
22 lines
651 B
Elixir
defmodule Plausible.Repo.Migrations.InitFunnels do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:funnels) do
|
|
add :name, :string, null: false
|
|
add :site_id, references(:sites, on_delete: :delete_all), null: false
|
|
timestamps()
|
|
end
|
|
|
|
create table(:funnel_steps) do
|
|
add :goal_id, references(:goals, on_delete: :delete_all), null: false
|
|
add :funnel_id, references(:funnels, on_delete: :delete_all), null: false
|
|
add :step_order, :integer, null: false
|
|
timestamps()
|
|
end
|
|
|
|
create unique_index(:funnel_steps, [:goal_id, :funnel_id])
|
|
create unique_index(:funnels, [:name, :site_id])
|
|
end
|
|
end
|