nxtgauge-backend-rust/crates/db
Ashwin Kumar Sivakumar 8e4d64d33b fix(db): correct ai_credit_packages pricing (paise not rupees), add missing ai_credit_orders table
Discovered while wiring up role-scoped AI credit packages: the active
seed migration (20260615060600) stored price_inr as 99/349/999/2499 -
values that read like whole rupees, but every consumer (PayU's
paise_to_rupee_string, matching pricing_packages' existing paise
convention) treats price_inr as paise, meaning a real purchase would
have charged ~1% of the intended price.

The actual fix already existed as 20260705110000_ai_credit_packages
.up.sql.skip (correct paise values + the ai_credit_orders table
create_order inserts into) but got disabled in the same bulk skip
pass as everything else this session has been un-tangling - its
CREATE TABLE ai_credit_packages (no IF NOT EXISTS) hit 'relation
already exists' since 20260615060600 had already created it, aborting
before ai_credit_orders was ever created.

Net effect before this fix: buying AI credits was completely broken
(create_order would 500 - no ai_credit_orders table to insert into).
Confirmed zero rows anywhere in ai_credit_orders (the table simply
didn't exist) - nothing to reconcile, this is a pre-launch fix.

New migration (not resurrecting the old .skip file, to keep a clean
linear history matching this session's other fixes): UPDATE the 4
known-wrong rows by name to their correct paise values, CREATE TABLE
IF NOT EXISTS ai_credit_orders. Applied to both nxtgauge_test and
prod; verified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-14 01:38:59 +05:30
..
migrations fix(db): correct ai_credit_packages pricing (paise not rupees), add missing ai_credit_orders table 2026-08-14 01:38:59 +05:30
migrations_new feat: pricing packages with multi-select roles, lead requests, mock checkout 2026-04-13 01:36:13 +02:00
src fix: close two real money/spend races (Tracecoin double-credit, unbounded AI overspend) 2026-07-21 05:51:23 +05:30
tests fix(test): use a fresh random user per ai_credits_reaper.rs run 2026-08-13 22:09:33 +05:30
Cargo.toml feat: Complete Ask Ash AI Credits implementation on high-performance branch (Tasks 1-10) 2026-07-06 01:49:16 +05:30