summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20221219215005_add_keys.exs
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2022-12-20 01:06:18 -0700
committerSimponic <loganhunt@simponic.xyz>2022-12-21 17:21:36 -0700
commitfed5d8a9e7b9500d317f2d8664cfe8ef4138154e (patch)
treef3d084146c2d410a4c1c8d95398599ceb1c8094f /priv/repo/migrations/20221219215005_add_keys.exs
parentb18899ffaffad71a2b2f8783d97bcab876ab22a1 (diff)
downloadchessh-fed5d8a9e7b9500d317f2d8664cfe8ef4138154e.tar.gz
chessh-fed5d8a9e7b9500d317f2d8664cfe8ef4138154e.zip
Add a simple echo server
Diffstat (limited to 'priv/repo/migrations/20221219215005_add_keys.exs')
-rw-r--r--priv/repo/migrations/20221219215005_add_keys.exs8
1 files changed, 5 insertions, 3 deletions
diff --git a/priv/repo/migrations/20221219215005_add_keys.exs b/priv/repo/migrations/20221219215005_add_keys.exs
index 15163dc..06ea2c5 100644
--- a/priv/repo/migrations/20221219215005_add_keys.exs
+++ b/priv/repo/migrations/20221219215005_add_keys.exs
@@ -3,12 +3,14 @@ defmodule Chessh.Repo.Migrations.AddKeys do
def change do
create table(:keys) do
- add :key, :string, null: false
- add :name, :string, null: false
+ add(:key, :text, null: false)
+ add(:name, :string, null: false)
- add :player_id, references(:players)
+ add(:player_id, references(:players))
timestamps()
end
+
+ create(unique_index(:keys, [:player_id, :key]))
end
end