diff options
author | Simponic <loganhunt@simponic.xyz> | 2022-12-19 20:56:59 -0700 |
---|---|---|
committer | Simponic <loganhunt@simponic.xyz> | 2022-12-19 20:56:59 -0700 |
commit | 466295f26fd7fc2d6b1c802e5a39f408d46a1df6 (patch) | |
tree | 42cdbf956c348f1bb04f5a7e26258fbe3e476af2 /priv/repo/migrations | |
parent | 110eb0b1990d5d5ee77f9368a9b7653cfdc07131 (diff) | |
download | chessh-466295f26fd7fc2d6b1c802e5a39f408d46a1df6.tar.gz chessh-466295f26fd7fc2d6b1c802e5a39f408d46a1df6.zip |
Add migrations, test keys, github workflows
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r-- | priv/repo/migrations/20221219082326_create_player.exs | 15 | ||||
-rw-r--r-- | priv/repo/migrations/20221219215005_add_keys.exs | 14 |
2 files changed, 29 insertions, 0 deletions
diff --git a/priv/repo/migrations/20221219082326_create_player.exs b/priv/repo/migrations/20221219082326_create_player.exs new file mode 100644 index 0000000..b99bb5e --- /dev/null +++ b/priv/repo/migrations/20221219082326_create_player.exs @@ -0,0 +1,15 @@ +defmodule Chessh.Repo.Migrations.CreatePlayer do + use Ecto.Migration + + def change do + execute "CREATE EXTENSION IF NOT EXISTS citext", "" + + create table(:players) do + add :username, :citext, null: false + add :hashed_password, :string, null: false + timestamps() + end + + 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 new file mode 100644 index 0000000..15163dc --- /dev/null +++ b/priv/repo/migrations/20221219215005_add_keys.exs @@ -0,0 +1,14 @@ +defmodule Chessh.Repo.Migrations.AddKeys do + use Ecto.Migration + + def change do + create table(:keys) do + add :key, :string, null: false + add :name, :string, null: false + + add :player_id, references(:players) + + timestamps() + end + end +end |