mix phx.gen.live Translations Translation translations \ lang:string title:string teaser:text content:map \ date:utc_datetime user_id:references:users \ public:boolean unauthorized:boolean article_id:references:articles
23 lines
637 B
Elixir
23 lines
637 B
Elixir
defmodule Outlook.Repo.Migrations.CreateTranslations do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:translations) do
|
|
add :lang, :string
|
|
add :title, :string
|
|
add :teaser, :text
|
|
add :content, :map
|
|
add :date, :utc_datetime
|
|
add :public, :boolean, default: false, null: false
|
|
add :unauthorized, :boolean, default: false, null: false
|
|
add :user_id, references(:users, on_delete: :nothing)
|
|
add :article_id, references(:articles, on_delete: :nothing)
|
|
|
|
timestamps()
|
|
end
|
|
|
|
create index(:translations, [:user_id])
|
|
create index(:translations, [:article_id])
|
|
end
|
|
end
|