-- =====================================================
-- IMPORT SCRIPT: Users and Balances from Old Database
-- Run this in phpMyAdmin for your NEW database
-- =====================================================

-- IMPORTANT: This script imports NON-ADMIN users only
-- Admin user (ID 1) is skipped to avoid conflicts

START TRANSACTION;

-- =====================================================
-- STEP 2: Import User Coin Balances
-- =====================================================

INSERT INTO `user_coin_balances` (`id`, `user_id`, `coin_id`, `balance`, `address`, `is_enabled`, `custom_fee`, `custom_swap_fee`, `created_at`, `updated_at`) VALUES
-- User 400 (Kelvin) balances
(456, 400, 1, 5.99700000, 'no wallet address', 1, NULL, NULL, '2025-09-03 13:21:22', '2026-01-01 11:18:16'),
(457, 400, 3, 48810.00000000, 'no wallet address', 1, 100.00000000, NULL, '2025-09-03 13:21:28', '2026-01-01 11:18:16'),
(472, 400, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:13:39', '2026-01-01 11:18:16'),
(473, 400, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:13:39', '2026-01-01 11:18:16'),
(474, 400, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:13:39', '2026-01-01 11:18:16'),
(475, 400, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:13:39', '2026-01-01 11:18:16'),
(476, 400, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:13:39', '2026-01-01 11:18:16'),
-- User 431 (Demo) balances
(477, 431, 1, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(478, 431, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(479, 431, 3, 49978.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(480, 431, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(481, 431, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(482, 431, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
(483, 431, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-09-05 14:21:10', '2026-01-01 11:18:16'),
-- User 400 additional coins
(484, 400, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:30', '2026-01-01 11:18:16'),
(485, 400, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:30', '2026-01-01 11:18:16'),
(486, 400, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:31', '2026-01-01 11:18:16'),
(487, 400, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:34', '2026-01-01 11:18:16'),
(488, 400, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:35', '2026-01-01 11:18:16'),
(489, 400, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:40', '2026-01-01 11:18:16'),
(490, 400, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-05 04:14:45', '2026-01-01 11:18:16'),
-- User 432 (Mula) balances
(491, 432, 1, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(492, 432, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(493, 432, 3, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(494, 432, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(495, 432, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(496, 432, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(497, 432, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(498, 432, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(499, 432, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(500, 432, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(501, 432, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(502, 432, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(503, 432, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
(504, 432, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2025-10-26 09:56:32', '2026-01-01 11:18:16'),
-- User 433 (Ezekiel) balances
(505, 433, 1, 0.23000000, 'bc1qzjqqqvznve9rvs54pzcszst4q89dwce7uqt5g4', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-04 14:21:30'),
(506, 433, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(507, 433, 3, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(508, 433, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(509, 433, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(510, 433, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(511, 433, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(512, 433, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(513, 433, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(514, 433, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(515, 433, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(516, 433, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(517, 433, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
(518, 433, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-02 09:57:15', '2026-01-02 09:57:15'),
-- User 435 (victoriano) balances
(533, 435, 1, 1.33000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:41:20'),
(534, 435, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(535, 435, 3, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(536, 435, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(537, 435, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(538, 435, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(539, 435, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(540, 435, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(541, 435, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(542, 435, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(543, 435, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(544, 435, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(545, 435, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
(546, 435, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-03 14:29:19', '2026-01-03 14:29:19'),
-- User 436 (Stephanie) balances
(547, 436, 1, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(548, 436, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(549, 436, 3, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(550, 436, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(551, 436, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(552, 436, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(553, 436, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(554, 436, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(555, 436, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(556, 436, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(557, 436, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(558, 436, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(559, 436, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
(560, 436, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-05 18:23:39', '2026-01-05 18:23:39'),
-- User 437 (Obi) balances
(561, 437, 1, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(562, 437, 2, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(563, 437, 3, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(564, 437, 4, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(565, 437, 5, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(566, 437, 6, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(567, 437, 7, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(568, 437, 8, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(569, 437, 9, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(570, 437, 10, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(571, 437, 11, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(572, 437, 12, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(573, 437, 13, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00'),
(574, 437, 15, 0.00000000, 'no wallet address', 1, NULL, NULL, '2026-01-06 15:53:00', '2026-01-06 15:53:00')
ON DUPLICATE KEY UPDATE 
    balance = VALUES(balance),
    address = VALUES(address),
    is_enabled = VALUES(is_enabled),
    updated_at = VALUES(updated_at);

-- =====================================================
-- STEP 3: Import Transactions (optional)
-- =====================================================

INSERT INTO `transactions` (`id`, `user_id`, `cryptoasset_id`, `from_coin_id`, `to_coin_id`, `type`, `which_crypto`, `from_crypto`, `to_crypto`, `transaction_hash`, `from_address`, `to_address`, `amount_in`, `amount_out`, `network_fee`, `rate`, `status`, `metadata`, `related_transaction_id`, `processed_at`, `created_at`, `updated_at`) VALUES
(62, 400, NULL, 3, NULL, 'withdrawal', NULL, NULL, NULL, NULL, NULL, NULL, 10.00000000, 10.00000000, 100.00000000, 1.00000000, 'completed', '{"external_address":"TX7UBmRxrspVkMqhfyUC5BDkXLdvum2E6r","network_fee":100,"transaction_hash":"f5078930e88359555b7efea8c2cbb24a068df77b0c39db02e2b761bd180aa7e0","current_rate":1,"transfer_type":"external"}', NULL, '2025-10-05 05:39:05', '2025-10-05 05:39:05', '2025-10-05 05:55:07'),
(63, 400, NULL, 3, NULL, 'withdrawal', NULL, NULL, NULL, NULL, NULL, NULL, 10.00000000, 10.00000000, 100.00000000, 1.00000000, 'completed', '{"external_address":"TX7UBmRxrspVkMqhfyUC5BDkXLdvum2E6r","network_fee":100,"transaction_hash":"150530ea72f1f9aaaa7a1919f5a9462276cb6b9ccf1ba0841a31e52cb9c3f8e1","current_rate":1,"transfer_type":"external"}', NULL, '2025-10-05 05:46:30', '2025-10-05 05:46:30', '2025-10-05 05:48:11'),
(64, 400, NULL, 3, NULL, 'withdrawal', NULL, NULL, NULL, NULL, NULL, NULL, 10.00000000, 10.00000000, 100.00000000, 1.00000000, 'completed', '{"external_address":"TX7UBmRxrspVkMqhfyUC5BDkXLdvum2E6r","network_fee":100,"transaction_hash":"d8ff41d3a681e2efa87e7b79d7d68730462554dafcb18a0af81007e98ac40aae","current_rate":1,"transfer_type":"external"}', NULL, '2025-10-05 05:48:55', '2025-10-05 05:48:55', '2025-10-05 06:12:08'),
(74, 400, NULL, 1, NULL, 'withdrawal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10.00000000, 0.00050000, 112425.70000000, 'completed', '{"external_address":"bc1qwlscd5gz2prrw7649tdp6cr5ux8psm244a0yuh","network_fee":0.0005,"transaction_hash":"121937c5c4da340d5f3ce07d666ab2f8145516efcb21672bc03136b7e481ddeb","current_rate":112425.7,"transfer_type":"external"}', NULL, '2025-10-26 10:38:15', '2025-10-26 10:38:15', '2025-10-26 11:10:24')
ON DUPLICATE KEY UPDATE 
    status = VALUES(status),
    updated_at = VALUES(updated_at);

COMMIT;

-- =====================================================
-- SUMMARY OF IMPORTED DATA:
-- =====================================================
-- Users: 7 (IDs: 400, 431, 432, 433, 435, 436, 437)
-- Important Balances:
--   - User 400 (Kelvin): 5.997 BTC, 48,810 USDT-TRC20
--   - User 431 (Demo): 49,978 USDT-TRC20
--   - User 433 (Ezekiel): 0.23 BTC
--   - User 435 (victoriano): 1.33 BTC
-- Transactions: 4 completed withdrawal records
-- =====================================================
