mix phx.gen.live Articles Article articles title:string\ /Crucial/git/phoenix-liveview-book content:text url:string language:string\ date:utc_datetime author_id:references:authors
19 lines
402 B
Elixir
19 lines
402 B
Elixir
defmodule Outlook.Repo.Migrations.CreateArticles do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:articles) do
|
|
add :title, :string
|
|
add :content, :text
|
|
add :url, :string
|
|
add :language, :string
|
|
add :date, :utc_datetime
|
|
add :author_id, references(:authors, on_delete: :nothing)
|
|
|
|
timestamps()
|
|
end
|
|
|
|
create index(:articles, [:author_id])
|
|
end
|
|
end
|