Skip to content

Commit

Permalink
Migration: add funnel related tables (#3022)
Browse files Browse the repository at this point in the history
priv/repo/migrations/20230417095029_init_funnels.exs - restored from:

aa59ade wip
4d039ba Make funnel names unique
4f3216b Unique steps
e55edf8 Rename funnel_goals->funnel_steps
34ceb3f dirty wip
  • Loading branch information
aerosol authored Jun 13, 2023
1 parent ba19f95 commit 3dce314
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions priv/repo/migrations/20230417095029_init_funnels.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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

0 comments on commit 3dce314

Please sign in to comment.