summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20230115201050_create_games.exs
blob: 418d1de9b0a110deaa0094296c1d5449d2d486d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
defmodule Chessh.Repo.Migrations.CreateGames do
  use Ecto.Migration

  def change do
    create table(:games) do
      add(:fen, :string)
      add(:moves, :integer, default: 0)

      add(:turn, :string)
      add(:winner, :string)
      add(:status, :string)

      add(:light_player_id, references(:players), null: true)
      add(:dark_player_id, references(:players), null: true)

      timestamps()
    end
  end
end