summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorElizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz>2023-05-29 16:28:27 -0700
committerGitHub <noreply@github.com>2023-05-29 16:28:27 -0700
commiteec32aa38a8762eccc8575a37a628bd5ae2cc1d0 (patch)
tree27f656780f5d25325c9ac0ec3db3557d774bf414 /priv/repo/migrations
parent8a5a2f358cb1f63a255b2daf6908536583986448 (diff)
downloadchessh-eec32aa38a8762eccc8575a37a628bd5ae2cc1d0.tar.gz
chessh-eec32aa38a8762eccc8575a37a628bd5ae2cc1d0.zip
Bots (#23)
* squash all the things for bots * fix warnings * change colors a bit and README updates * fix frontend warnings
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20230529193453_add_citext.exs11
-rw-r--r--priv/repo/migrations/20230529193504_add_bots.exs22
2 files changed, 33 insertions, 0 deletions
diff --git a/priv/repo/migrations/20230529193453_add_citext.exs b/priv/repo/migrations/20230529193453_add_citext.exs
new file mode 100644
index 0000000..371df8d
--- /dev/null
+++ b/priv/repo/migrations/20230529193453_add_citext.exs
@@ -0,0 +1,11 @@
+defmodule Chessh.Repo.Migrations.AddCitext do
+ use Ecto.Migration
+
+ def up do
+ execute("CREATE EXTENSION citext")
+ end
+
+ def down do
+ execute("DROP EXTENSION citext")
+ end
+end
diff --git a/priv/repo/migrations/20230529193504_add_bots.exs b/priv/repo/migrations/20230529193504_add_bots.exs
new file mode 100644
index 0000000..3f48c0a
--- /dev/null
+++ b/priv/repo/migrations/20230529193504_add_bots.exs
@@ -0,0 +1,22 @@
+defmodule Chessh.Repo.Migrations.AddBots do
+ use Ecto.Migration
+
+ def change do
+ create table(:bots) do
+ add(:name, :citext, null: false)
+ add(:webhook, :string, null: false)
+ add(:token, :string, null: false)
+ add(:public, :boolean, null: false)
+ add(:player_id, references(:players), null: false)
+
+ timestamps()
+ end
+
+ create(unique_index(:bots, [:name]))
+ create(unique_index(:bots, [:token]))
+
+ alter table(:games) do
+ add(:bot_id, references(:bots), null: true)
+ end
+ end
+end