Phase 1 - Database foundation: - Categories, businesses, hours, photos migrations - Ecto schemas with changesets and validations Phase 2 - Business logic: - Logic module with pure functions (Haversine distance, slug generation, etc.) - Queries module for database operations with filtering - Businesses context coordinating Logic and Queries layers - 43 tests covering logic and queries 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
510 B
Elixir
18 lines
510 B
Elixir
defmodule Localspot.Repo.Migrations.CreateBusinessPhotos do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:business_photos) do
|
|
add :url, :string, null: false
|
|
add :alt_text, :string
|
|
add :position, :integer, default: 0, null: false
|
|
add :primary, :boolean, default: false, null: false
|
|
|
|
add :business_id, references(:businesses, on_delete: :delete_all), null: false
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:business_photos, [:business_id])
|
|
end
|
|
end
|