Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
37650 amit 1
-- Retire user.counter / user.privatedealuser / user.privatedealuseraddressmapping
2
--
3
-- Partner GST moved to fofo.fofo_store.gst_number in the Feb-2026 migration. Since then
4
-- counter.gstin has had no reader (Counter.getGstin() had no callers) and privatedealuser
5
-- was read only to decide its own insert-vs-update. Code writes removed in dao r37648 /
6
-- web r37649.
7
--
8
-- RUN ONLY AFTER dao r37648 + web r37649 ARE DEPLOYED. The currently deployed code still
9
-- inserts into these tables on every partner onboarding/update; renaming them first makes
10
-- that write fail and rolls back the retailer save.
11
--
12
-- Rename rather than DROP: reversible for as long as the renamed tables are kept.
13
-- Verified before writing this script (2026-09-16):
14
--   * no foreign keys reference either table
15
--   * no Reportico report on static0 references them (240 XMLs, 13 projects)
16
--   * counters 1,979 rows / privatedealuser 35,928 rows / address mapping 3,381 rows
17
 
18
-- 1. Confirm nothing has written since the deploy (expect the same max ids as at deploy time)
19
SELECT MAX(id) max_counter_id FROM user.counter;
20
SELECT COUNT(*) pdu_rows FROM user.privatedealuser;
21
 
22
-- 2. Rename out of the way
23
RENAME TABLE user.counter                     TO user.counter_dropped_20260916;
24
RENAME TABLE user.privatedealuser             TO user.privatedealuser_dropped_20260916;
25
RENAME TABLE user.privatedealuseraddressmapping TO user.privatedealuseraddressmapping_dropped_20260916;
26
 
27
-- 3. Verify: onboarding a partner and updating retailer details must still succeed.
28
-- Rollback if needed:
29
--   RENAME TABLE user.counter_dropped_20260916 TO user.counter;
30
--   RENAME TABLE user.privatedealuser_dropped_20260916 TO user.privatedealuser;
31
--   RENAME TABLE user.privatedealuseraddressmapping_dropped_20260916 TO user.privatedealuseraddressmapping;
32
 
33
-- 4. After a safe interval with no issues:
34
--   DROP TABLE user.counter_dropped_20260916;
35
--   DROP TABLE user.privatedealuser_dropped_20260916;
36
--   DROP TABLE user.privatedealuseraddressmapping_dropped_20260916;