philomena/priv/repo/migrations/20200503002523_create_image_sources.exs

16 lines
439 B
Elixir

defmodule Philomena.Repo.Migrations.CreateImageSources do
use Ecto.Migration
def change do
create table(:image_sources) do
add :image_id, references(:images), null: false
add :source, :text, null: false
end
create unique_index("image_sources", [:image_id, :source])
create constraint("image_sources", "length_must_be_valid",
check: "length(source) between 8 and 1024"
)
end
end