defmodule Berrypod.Repo.Migrations.CreateNavItems do use Ecto.Migration def change do create table(:nav_items, primary_key: false) do add :id, :binary_id, primary_key: true add :location, :string, null: false add :label, :string, null: false add :url, :string, null: false add :page_id, references(:pages, type: :binary_id, on_delete: :nilify_all) add :position, :integer, null: false, default: 0 timestamps(type: :utc_datetime) end create index(:nav_items, [:location, :position]) create index(:nav_items, [:page_id]) end end