Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

-- Align user.address of active INTERNAL fofo stores with their mapped warehouse address.
-- Source of truth: transaction.warehouseaddressmapping -> transaction.warehouseaddressmaster,
-- split exactly as WarehouseAddressMaster.getCustomAddress() does, state via inventory.statemaster.
-- In-place update: transaction.addId already points at these rows, and user.address feeds no
-- issued document (invoices read transaction.`order`.customer_address*), so history is unaffected.

CREATE TABLE IF NOT EXISTS user._bak_address_internal_whsync_20260916 AS
SELECT a.* FROM user.address a
JOIN user.user u ON u.default_address_id = a.id
JOIN fofo.fofo_store fs ON fs.id = u.id
WHERE fs.fofo_type='INTERNAL' AND fs.active=1;

-- DLSD693 / fofo 175139480
UPDATE user.address SET line_1='Basement H.No- K819', line_2='Block K-2, Mahipalpur Extn', city='New Delhi', state='Delhi', pin='110037', update_timestamp=NOW() WHERE id=655253;
-- DLSW097 / fofo 175138806
UPDATE user.address SET line_1='Basement H.No- K819', line_2='Block K-2, Mahipalpur Extn', city='New Delhi', state='Delhi', pin='110037', update_timestamp=NOW() WHERE id=654183;
-- DLSW1068 / fofo 175139884
UPDATE user.address SET line_1='Basement H.No- K819', line_2='Block K-2, Mahipalpur Extn', city='New Delhi', state='Delhi', pin='110037', update_timestamp=NOW() WHERE id=655835;
-- DLSW869 / fofo 175139678
UPDATE user.address SET line_1='Basement H.No- K819', line_2='Block K-2, Mahipalpur Extn', city='New Delhi', state='Delhi', pin='110037', update_timestamp=NOW() WHERE id=655515;
-- MPIN1613 / fofo 175140468
UPDATE user.address SET line_1='739, Ground Floor, Sector B', line_2='Scheme No. 136, Main Road, Near Brilliant Aura, Vijay Nagar', city='Indore', state='Madhya Pradesh', pin='452010', update_timestamp=NOW() WHERE id=656736;
-- PBLDH293 (address 654536) already aligned - no change
-- RJJPR294 / fofo 175139010
UPDATE user.address SET line_1='53', line_2='Indraprastha Colony, Vaishali Nagar', city='Jaipur', state='Rajasthan', pin='302021', update_timestamp=NOW() WHERE id=655453;
-- UKDH498 / fofo 171697468
UPDATE user.address SET line_1='Ground floor of Ganga tower', line_2='6 cross road', city='Dehradun', state='Uttarakhand', pin='248001', update_timestamp=NOW() WHERE id=656555;
-- UPGBN1516 / fofo 175140371
UPDATE user.address SET line_1='FIRST FLOOR, D-97', line_2='SECTOR-63, Noida', city='Gautambuddha Nagar', state='Uttar Pradesh', pin='201301', update_timestamp=NOW() WHERE id=656636;
-- UPGBN1517 / fofo 175140372
UPDATE user.address SET line_1='FIRST FLOOR, D-97', line_2='SECTOR-63, Noida', city='Gautambuddha Nagar', state='Uttar Pradesh', pin='201301', update_timestamp=NOW() WHERE id=656637;
-- UPLKO099 / fofo 175138808
UPDATE user.address SET line_1='F 209 Transport Nagar', line_2='Near Parking No 5', city='Lucknow', state='Uttar Pradesh', pin='226012', update_timestamp=NOW() WHERE id=654185;
-- UPNO199 / fofo 175138912
UPDATE user.address SET line_1='FIRST FLOOR, D-97', line_2='SECTOR-63, Noida', city='Gautambuddha Nagar', state='Uttar Pradesh', pin='201301', update_timestamp=NOW() WHERE id=654407;
-- UPTest / fofo 175120474
UPDATE user.address SET line_1='FIRST FLOOR, D-97', line_2='SECTOR-63, Noida', city='Gautambuddha Nagar', state='Uttar Pradesh', pin='201301', update_timestamp=NOW() WHERE id=647440;

-- 12 rows updated