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
