index.community/backend/lib/backend/most_recent_crawl.ex

23 lines
453 B
Elixir
Raw Normal View History

2019-08-10 13:21:22 +00:00
defmodule Backend.MostRecentCrawl do
use Ecto.Schema
import Ecto.Changeset
schema "most_recent_crawl" do
belongs_to :instance, Backend.Instance,
references: :domain,
type: :string,
foreign_key: :instance_domain
belongs_to :crawl, Backend.Crawl
timestamps()
end
@doc false
def changeset(edge, attrs) do
edge
|> cast(attrs, [:instance, :crawl])
|> validate_required([:instance, :crawl])
end
end