summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20230115201050_create_games.exs
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations/20230115201050_create_games.exs')
-rw-r--r--priv/repo/migrations/20230115201050_create_games.exs19
1 files changed, 19 insertions, 0 deletions
diff --git a/priv/repo/migrations/20230115201050_create_games.exs b/priv/repo/migrations/20230115201050_create_games.exs
new file mode 100644
index 0000000..418d1de
--- /dev/null
+++ b/priv/repo/migrations/20230115201050_create_games.exs
@@ -0,0 +1,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