# frozen_string_literal: true

class UxToolkitCronState < ActiveRecord::Base
  DEFAULT_NAME = 'default'

  validates :name, presence: true, uniqueness: true

  def self.default_record
    find_or_create_by!(name: DEFAULT_NAME)
  rescue ActiveRecord::RecordNotUnique
    find_by!(name: DEFAULT_NAME)
  end
end
