19 lines
510 B
Elixir
19 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
|