localspot/priv/repo/migrations/20251201042602_create_business_hours.exs
Kevin Sivic e8fd635ddb Add Businesses context with A-Frame architecture
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>
2025-11-30 23:55:29 -05:00

19 lines
557 B
Elixir

defmodule Localspot.Repo.Migrations.CreateBusinessHours do
use Ecto.Migration
def change do
create table(:business_hours) do
add :day_of_week, :integer, null: false
add :opens_at, :time
add :closes_at, :time
add :closed, :boolean, default: false, null: false
add :business_id, references(:businesses, on_delete: :delete_all), null: false
timestamps(type: :utc_datetime)
end
create index(:business_hours, [:business_id])
create unique_index(:business_hours, [:business_id, :day_of_week])
end
end