510 B · text History 5dd4046
defmodule CartosnapApp.Photos.PhotoTrip do
  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
  schema "photo_photo_trips" do

    field :photo, :binary_id
    field :trip, :binary_id
#     belongs_to :photo, :binary_id
#     belongs_to :trip, :binary_id

    timestamps()
  end

  @doc false
  def changeset(photo_trip, attrs) do
    photo_trip
    |> cast(attrs, [:photo, :trip])
    |> validate_required([:photo, :trip])
  end
end