Skip to content

chore(config): drop the unused minitems / maxitems database fields - #34

Merged
icemansparks merged 1 commit into
merkerhoodfrom
chore/drop-dead-minmaxitems
Aug 24, 2026
Merged

chore(config): drop the unused minitems / maxitems database fields#34
icemansparks merged 1 commit into
merkerhoodfrom
chore/drop-dead-minmaxitems

Conversation

@icemansparks

Copy link
Copy Markdown
Collaborator

Follow-up to the discussion on #33.

Why

AHBConfig::InitializeFromSql() had both reads commented out:

//SetMinItems(WorldDatabase.Query("SELECT minitems FROM mod_auctionhousebot ...
//SetMaxItems(WorldDatabase.Query("SELECT maxitems FROM mod_auctionhousebot ...

So the minitems / maxitems columns were never read. The seller's ceiling comes from AuctionHouseBot.MaxItems in the conf file. Both columns were still being written by .ahbotoptions minitems/maxitems, which made editing them look effective while doing nothing — the exact trap worth removing.

MinItems was worse: GetMinItems() had no caller anywhere. The conf option (AuctionHouseBot.MinItems = 10000), the member, the accessors, the column and the GM command were all completely inert.

Changes

  • Removed minItems (member, Get/SetMinItems, conf read, reset, copy-ctor), AuctionHouseBot.MinItems from the conf dist, the minitems GM command, its enum value and its help line.
  • Removed the two commented-out SQL reads and the commented minItems debug log.
  • .ahbotoptions maxitems keeps working as a runtime-only override — it already recalculates the per-quality maxima via CalculatePercents() — but no longer UPDATEs a column nothing reads. Help text now says "until restart".
  • New migration z_2026_08_24_00_drop_minitems_maxitems.sql drops both columns.
  • README: corrected the "Market population control" section.

Migration notes

  • The migration is guarded via information_schema and re-runnable, and works on MySQL as well as MariaDB (MySQL has no DROP COLUMN IF EXISTS).
  • mod_auctionhousebot.sql is deliberately left untouched. That file starts with DROP TABLE IF EXISTS; changing it changes its hash and the DB updater would re-apply it, wiping the tuned prices and percentages in the live table. The consequence is that a fresh install creates the two columns and this migration drops them again immediately afterwards — the z_ prefix keeps it sorted after the base file, same trick z_filter_disabled_and_trash.sql uses.
  • Existing mod_ahbot.conf files may still carry a AuctionHouseBot.MinItems line. Harmless — unknown options are ignored — but it can be deleted.

Verification

  • Grepped clean: no minItems / minitems references remain in src/, conf/ or docs/.
  • Full module compile: the core-build workflow on this PR.
  • The migration SQL has not been executed anywhere yet — no MySQL/MariaDB on the box I prepared this on. It should be run against testcore (LXC 113) before it reaches live.

Note on ordering with #33

Independent of #33 (that one only touches GetItemsToSell()); no conflicts expected in either merge order.

InitializeFromSql() had both SELECTs commented out, so neither column was ever
read: the seller's ceiling comes from AuctionHouseBot.MaxItems in the conf file.
Editing the columns, or setting them through ".ahbotoptions minitems/maxitems",
looked like it worked and changed nothing.

MinItems went further than that - GetMinItems() had no caller left anywhere, so
AuctionHouseBot.MinItems, the member, the accessors, the column and the GM
command were all inert. All removed.

The maxitems GM command stays as a runtime-only override (it already recalculates
the per-quality maxima) but no longer writes to a column nobody reads.

The column drop ships as a guarded, re-runnable z_-prefixed migration.
mod_auctionhousebot.sql is deliberately left untouched: changing that file makes
the DB updater re-apply its DROP TABLE and wipe the tuned prices and percentages.
@icemansparks
icemansparks merged commit 38e6a83 into merkerhood Aug 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant