以下の内容はhttps://otiai10.hatenablog.com/entry/2016/02/16/181754より取得しました。


【Elixir】Ecto.Migrationで外部キー参照とNOT NULL制約を追加

こういうことを学んだので↓

otiai10.hatenablog.com

これを、Ecto.Migrationでやりたい

defmodule MyApp.Repo.Migrations.CreateUserToken do
  use Ecto.Migration

  def change do
    create table(:posts) do
      add :user_id, references(:users, on_delete: :delete_all), null: false
      add :message, :string

      timestamps
    end
    create index(:posts, [:user_id])

  end
end

以上

DRY




以上の内容はhttps://otiai10.hatenablog.com/entry/2016/02/16/181754より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14