509 B · text History e569b6d
defmodule CartosnapApp.Repo.Migrations.CreatePhotoPhotoTrips do
  use Ecto.Migration

  def change do
    create table(:photo_photo_trips, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :photo, references(:photo_photos, on_delete: :delete_all, type: :binary_id)
      add :trip, references(:photo_trips, on_delete: :delete_all, type: :binary_id)

      timestamps()
    end

    create index(:photo_photo_trips, [:photo])
    create index(:photo_photo_trips, [:trip])
  end
end