defmodule Zoeyscomputer.Repo.Migrations.CreateApiKeys do
  use Ecto.Migration

  def change do
    create table(:api_keys) do
      add :token, :string
      add :name, :string
      add :user_id, references(:users, on_delete: :nothing)

      timestamps(type: :utc_datetime)
    end

    create unique_index(:api_keys, [:token])
    create index(:api_keys, [:user_id])
  end
end
