2022-12-19 22:56:59 -05:00
|
|
|
defmodule Chessh.Repo.Migrations.AddKeys do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:keys) do
|
2022-12-20 03:06:18 -05:00
|
|
|
add(:key, :text, null: false)
|
|
|
|
add(:name, :string, null: false)
|
2022-12-19 22:56:59 -05:00
|
|
|
|
2023-01-19 16:04:10 -05:00
|
|
|
add(:player_id, references(:players), null: false)
|
2022-12-19 22:56:59 -05:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
2022-12-20 03:06:18 -05:00
|
|
|
|
|
|
|
create(unique_index(:keys, [:player_id, :key]))
|
2022-12-19 22:56:59 -05:00
|
|
|
end
|
|
|
|
end
|