diff options
Diffstat (limited to 'priv/repo/migrations/20230529193504_add_bots.exs')
-rw-r--r-- | priv/repo/migrations/20230529193504_add_bots.exs | 22 |
1 files changed, 22 insertions, 0 deletions
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 |