Add Articles
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
This commit is contained in:
18
priv/repo/migrations/20221226161611_create_articles.exs
Normal file
18
priv/repo/migrations/20221226161611_create_articles.exs
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
Reference in New Issue
Block a user