Migration:
defmodule Stats.Repo.Migrations.CreateSourcesTable do
use Ecto.Migration
def change do
create table(:sources) do
add :nth, :integer, null: false
add :url, :string, null: false
add :contents, :text
end
create index("sources", [:nth], unique: true)
create index("sources", [:url], unique: true)
end
end
Schema:
defmodule Stats.Source do
use Stats.Schema
import Ecto.Changeset
schema "sources" do
has_many(:meetings, Stats.Meeting)
field(:nth, :integer)
field(:url, :string)
field(:contents, :string)
end
end






















