berrypod/priv/repo/migrations/20260128235847_create_product_images.exs
jamey 9528700862 rename project from SimpleshopTheme to Berrypod
All modules, configs, paths, and references updated.
836 tests pass, zero warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:23:15 +00:00

22 lines
617 B
Elixir

defmodule Berrypod.Repo.Migrations.CreateProductImages do
use Ecto.Migration
def change do
create table(:product_images, primary_key: false) do
add :id, :binary_id, primary_key: true
add :product_id, references(:products, type: :binary_id, on_delete: :delete_all),
null: false
add :src, :string, null: false
add :position, :integer, default: 0, null: false
add :alt, :string
timestamps(type: :utc_datetime)
end
# Composite index covers queries on product_id alone (leftmost prefix)
create index(:product_images, [:product_id, :position])
end
end