defmodule BDS.Settings.Setting do
  @moduledoc false

  use Ecto.Schema
  import Ecto.Changeset

  @primary_key {:key, :string, autogenerate: false}

  schema "settings" do
    field :value, :string
    field :updated_at, :integer
  end

  def changeset(setting, attrs) do
    setting
    |> cast(attrs, [:key, :value, :updated_at], empty_values: [nil])
    |> validate_required([:key, :value, :updated_at])
  end
end
