Subversion Repositories SmartDukaan

Rev

Rev 37650 | Blame | Compare with Previous | Last modification | View Log | RSS feed

-- Retire user.counter / user.privatedealuser / user.privatedealuseraddressmapping
--
-- Partner GST moved to fofo.fofo_store.gst_number in the Feb-2026 migration. Since then
-- counter.gstin has had no reader (Counter.getGstin() had no callers) and privatedealuser
-- was read only to decide its own insert-vs-update. Code writes removed in dao r37648 /
-- web r37649.
--
-- APPLIED on hadb1 2026-09-17 20:1x, after dao r37648 + web r37649 were deployed (fofo 09-17 11:35,
-- web 09-16 19:56). Kept here for the rollback and the later DROP.
-- RUN ONLY AFTER dao r37648 + web r37649 ARE DEPLOYED. The currently deployed code still
-- inserts into these tables on every partner onboarding/update; renaming them first makes
-- that write fail and rolls back the retailer save.
--
-- Rename rather than DROP: reversible for as long as the renamed tables are kept.
-- Verified before writing this script (2026-09-16):
--   * no foreign keys reference either table
--   * no Reportico report on static0 references them (240 XMLs, 13 projects)
--   * counters 1,979 rows / privatedealuser 35,928 rows / address mapping 3,381 rows

-- 1. Confirm nothing has written since the deploy (expect the same max ids as at deploy time)
SELECT MAX(id) max_counter_id FROM user.counter;
SELECT COUNT(*) pdu_rows FROM user.privatedealuser;

-- 2. Rename out of the way
RENAME TABLE user.counter                     TO user.counter_dropped_20260917;
RENAME TABLE user.privatedealuser             TO user.privatedealuser_dropped_20260917;
RENAME TABLE user.privatedealuseraddressmapping TO user.privatedealuseraddressmapping_dropped_20260917;

-- 3. Verify: onboarding a partner and updating retailer details must still succeed.
-- Rollback if needed:
--   RENAME TABLE user.counter_dropped_20260917 TO user.counter;
--   RENAME TABLE user.privatedealuser_dropped_20260917 TO user.privatedealuser;
--   RENAME TABLE user.privatedealuseraddressmapping_dropped_20260917 TO user.privatedealuseraddressmapping;

-- 4. After a safe interval with no issues:
--   DROP TABLE user.counter_dropped_20260917;
--   DROP TABLE user.privatedealuser_dropped_20260917;
--   DROP TABLE user.privatedealuseraddressmapping_dropped_20260917;