-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `flovhggj_rock`
--

-- --------------------------------------------------------

--
-- Table structure for table `commissions`
--

CREATE TABLE `commissions` (
  `id` int NOT NULL,
  `user_id` int NOT NULL,
  `referred_user_id` int NOT NULL,
  `amount` double NOT NULL,
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `investments`
--

CREATE TABLE `investments` (
  `id` int NOT NULL,
  `user_id` int DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `start_time` datetime DEFAULT NULL,
  `status` varchar(20) DEFAULT NULL,
  `daily_percentage` decimal(5,2) DEFAULT '0.00',
  `last_earnings_time` datetime DEFAULT NULL,
  `daily_earnings` decimal(10,2) DEFAULT NULL,
  `total_earned` decimal(10,2) DEFAULT '0.00',
  `cycle_days` int DEFAULT '30'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `investments`
--

INSERT INTO `investments` (`id`, `user_id`, `amount`, `start_time`, `status`, `daily_percentage`, `last_earnings_time`, `daily_earnings`, `total_earned`, `cycle_days`) VALUES
(51, 251, 1000.00, '2025-09-21 22:48:41', 'active', 5.00, '2025-09-22 14:16:05', 50.00, 50.00, 45),
(52, 249, 100.00, '2025-09-22 18:35:17', 'active', 5.00, '2025-09-22 21:35:34', 5.00, 5.00, 45),
(53, 255, 500.00, '2025-09-23 19:28:48', 'active', 10.00, '2025-09-24 01:44:00', 50.00, 50.00, 45),
(54, 307, 300.00, '2025-09-24 05:20:44', 'active', 10.00, '0000-00-00 00:00:00', 30.00, 0.00, 45),
(55, 288, 300.00, '2025-09-24 05:22:38', 'active', 10.00, '2025-09-24 08:36:46', 30.00, 30.00, 45),
(56, 251, 150.00, '2025-09-24 06:00:05', 'active', 10.00, '0000-00-00 00:00:00', 15.00, 0.00, 45);

-- --------------------------------------------------------

--
-- Table structure for table `mpesa_recharges`
--

CREATE TABLE `mpesa_recharges` (
  `id` int NOT NULL,
  `user_id` int DEFAULT NULL,
  `amount` double DEFAULT NULL,
  `sms` text,
  `status` varchar(20) DEFAULT 'pending',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `mpesa_recharges`
--

INSERT INTO `mpesa_recharges` (`id`, `user_id`, `amount`, `sms`, `status`, `created_at`) VALUES
(38, 252, 140, 'Cskygsgy ksgsgs', 'approved', '2025-09-22 16:40:58'),
(39, 249, 100, 'Umetuma Tsh 50,000.00 sawa na KES 2442.93 (FX 0.04) kwenda +254789170537 ESTHER MUTINDI Tarehe 22/09/2025. Makato Tsh 820.00 Salio Jipya Tsh 5,128.99 TID XX250922.2048.X85677', 'approved', '2025-09-22 21:34:18'),
(40, 329, 150, 'Money sent to Walieta Walieta on 973334172.Amount ZMW 150.00. Your bal is ZMW 221.02.TID: PP250919.1357.Z46660.', 'pending', '2025-09-24 06:37:22'),
(41, 336, 150, 'You have transferred 150.00 ZMW to Namwila Namwila (260763776043) from your mobile money account 65021815 at 2025-09-24 06:34:26. Your new balance: 62.03 ZMW. Message from sender: investment. Message to receiver: investment. Financial Transaction ID: 7765873908.', 'pending', '2025-09-24 07:35:41');

-- --------------------------------------------------------

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` int NOT NULL,
  `user_id` int NOT NULL,
  `task_name` varchar(255) DEFAULT NULL,
  `reward` decimal(10,2) DEFAULT NULL,
  `status` enum('pending','completed') DEFAULT 'pending',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `completed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `withdrawals`
--

CREATE TABLE `withdrawals` (
  `id` int NOT NULL,
  `user_id` int NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `method` varchar(50) DEFAULT 'M-PESA',
  `details` varchar(255) DEFAULT NULL,
  `requested_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `approved_at` datetime DEFAULT NULL,
  `mpesa_number` varchar(20) DEFAULT NULL,
  `mpesa_name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `withdrawals`
--

INSERT INTO `withdrawals` (`id`, `user_id`, `amount`, `status`, `method`, `details`, `requested_at`, `approved_at`, `mpesa_number`, `mpesa_name`) VALUES
(156, 251, 70.00, 'approved', 'M-PESA', NULL, '2025-09-22 14:10:47', '2025-09-22 11:11:41', '06', 'Alex Washinton'),
(157, 251, 100.00, 'approved', 'M-PESA', NULL, '2025-09-22 16:42:12', '2025-09-22 14:07:36', '070000000', 'Alex Washinton');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `commissions`
--
ALTER TABLE `commissions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `investments`
--
ALTER TABLE `investments`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `mpesa_recharges`
--
ALTER TABLE `mpesa_recharges`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `commissions`
--
ALTER TABLE `commissions`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `investments`
--
ALTER TABLE `investments`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=57;

--
-- AUTO_INCREMENT for table `mpesa_recharges`
--
ALTER TABLE `mpesa_recharges`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

--
-- AUTO_INCREMENT for table `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `withdrawals`
--
ALTER TABLE `withdrawals`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=158;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD CONSTRAINT `withdrawals_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
COMMIT;

