Where are my circ rules in the database as of 20.05?

Back in 2020, I wrote this blog post detailing where to find all of your circ rules in the database, should you wish to view them via SQL rather than via the regular interface. At that time, our partner libraries were on Koha version 19.05 and the various circulation rules were scattered across several tables in the database.

In Koha version 20.05, we overhauled how circ rules get stored. Now everything gets stored in the circulation_rules table. As you can see in the schema, this table records the library, patron category, and item type to which this rule applies, a "rule_name," and a "rule_value." With this basic structure, we can keep all our rules in one easy place. If library, category, or itemtype are empty in a rule, we know that's an "All" or default rule. To give a visual example, here's part of a simple All/All rule and what it shows in the database:

So we don't have a set of cryptic table names to remember anymore, but we do have a list of possible rule_names to keep track of. Most of them are fairly clear, but a few get confusing. In the following screenshots, I've numbered the various fields on the circulation rules page to correspond with an alphabetical list of rule_names.

  1. article_requests - determines whether or not article requests are allowed
  2. auto_renew - determines whether or not checkouts renew automatically
  3. cap_fine_to_replacement_price - determines whether or not the overdue fine is capped at the item's replacement price
  4. chargeperiod - sets the fine charging interval
  5. chargeperiod_charge_at - determines when in the interval the fine is charge
  6. fine - sets the fine amount
  7. finedays - sets the number of days for a suspension
  8. firstremind - sets the grace period
  9. hardduedate - sets the date in a hard due date
  10. hardduedatecompare - sets the comparison for a hard due date
  11. hold_fulfillment_policy - records the value for "Hold pickup library match" at either the default or itemtype levels
  12. holdallowed - records the value for "Hold policy" at either the default or itemtype levels
  13. holds_per_day - sets the number of holds allowed per day
  14. holds_per_record - sets the number of holds allowed per record
  15. issuelength - sets the loan period
  16. lengthunit - records the unit in which the loan, fine, and suspension intervals are measured
  17. max_holds - records the value for "Total holds allowed" at either the default or category levels
  18. maxissueqty - sets "Current checkouts allowed" for a specific rule
  19. maxonsiteissueqty - sets "Current on-site checkouts allowed" for a specific rule
  20. maxsuspensiondays - sets the maximum number of suspension days
  21. no_auto_renewal_after - sets the number of days after which an automatic renewal is prevented
  22. no_auto_renewal_after_hard_limit - sets the date for a hard limit for automatic renewal
  23. norenewalbefore - sets the number of days before the due date in which to allow renewal
  24. note - records a note about this circulation rule
  25. onshelfholds - determines whether or not on-shelf holds are allowed
  26. opacitemholds - determines whether or not item-level holds are allowed via the OPAC
  27. overduefinescap - sets the amount at which to cap overdue fines
  28. patron_maxissueqty - records the value for "Total current checkouts allowed" at either the default or category levels
  29. patron_maxonsiteissueqty - records the value for "Total current on-site checkouts allowed" at either the default or category levels
  30. refund - records the value for "lost item fee refund on return policy"
  31. renewalperiod - sets the length of a renewal
  32. renewalsallowed - sets the number of renewals allowed
  33. rentaldiscount - sets the rental discount
  34. reservesallowed - sets "Holds allowed (total)" for a specific rule
  35. returnbranch - records the value for "Return policy" at either the default or itemtype levels
  36. suspension_chargeperiod - sets the suspension interval