summaryrefslogtreecommitdiff
path: root/priv
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
parentb18899ffaffad71a2b2f8783d97bcab876ab22a1 (diff)
downloadchessh-fed5d8a9e7b9500d317f2d8664cfe8ef4138154e.tar.gz
chessh-fed5d8a9e7b9500d317f2d8664cfe8ef4138154e.zip
Add a simple echo server
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20221219082326_create_player.exs8
-rw-r--r--priv/repo/migrations/20221219215005_add_keys.exs8
2 files changed, 9 insertions, 7 deletions
diff --git a/priv/repo/migrations/20221219082326_create_player.exs b/priv/repo/migrations/20221219082326_create_player.exs
index b99bb5e..4c0c553 100644
--- a/priv/repo/migrations/20221219082326_create_player.exs
+++ b/priv/repo/migrations/20221219082326_create_player.exs
@@ -2,14 +2,14 @@ defmodule Chessh.Repo.Migrations.CreatePlayer do
use Ecto.Migration
def change do
- execute "CREATE EXTENSION IF NOT EXISTS citext", ""
+ execute("CREATE EXTENSION IF NOT EXISTS citext", "")
create table(:players) do
- add :username, :citext, null: false
- add :hashed_password, :string, null: false
+ add(:username, :citext, null: false)
+ add(:hashed_password, :string, null: false)
timestamps()
end
- create unique_index(:players, [:username])
+ create(unique_index(:players, [:username]))
end
end
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