2022-12-19 22:56:59 -05:00
|
|
|
defmodule Chessh.Repo.Migrations.CreatePlayer do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
2022-12-20 03:06:18 -05:00
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS citext", "")
|
2022-12-19 22:56:59 -05:00
|
|
|
|
|
|
|
create table(:players) do
|
2023-01-17 20:24:16 -05:00
|
|
|
add(:github_id, :integer, null: false)
|
2022-12-20 03:06:18 -05:00
|
|
|
add(:username, :citext, null: false)
|
2023-01-17 20:24:16 -05:00
|
|
|
add(:hashed_password, :string, null: true)
|
2022-12-19 22:56:59 -05:00
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
2022-12-20 03:06:18 -05:00
|
|
|
create(unique_index(:players, [:username]))
|
2023-01-17 20:24:16 -05:00
|
|
|
create(unique_index(:players, [:github_id]))
|
2022-12-19 22:56:59 -05:00
|
|
|
end
|
|
|
|
end
|