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

START TRANSACTION;



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

--
-- Table structure for table `auto_deductions`
--

CREATE TABLE `auto_deductions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` int(11) NOT NULL,
  `deduction_date` date NOT NULL,
  `cycle` varchar(10) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `pending_registrations`
--

CREATE TABLE `pending_registrations` (
  `id` int(11) NOT NULL,
  `tx_ref` varchar(120) DEFAULT NULL,
  `fullname` varchar(150) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `gender` enum('male','female','other') DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `referrer_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT 8000.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `rewards`
--

CREATE TABLE `rewards` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('unclaimed','claimed') DEFAULT 'unclaimed',
  `created_at` datetime DEFAULT current_timestamp(),
  `claimed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `rewards`
--

INSERT INTO `rewards` (`id`, `user_id`, `amount`, `status`, `created_at`, `claimed_at`) VALUES
(1, 7, '92000.00', 'claimed', '2025-12-11 05:33:30', '2025-12-11 05:35:58'),
(2, 6, '9600.00', 'claimed', '2025-12-11 05:41:46', '2025-12-11 06:16:22'),
(3, 7, '84000.00', 'claimed', '2025-12-11 05:41:47', '2025-12-11 05:46:34');

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

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `type` enum('registration','commission','withdrawal') DEFAULT 'registration',
  `amount` decimal(12,2) DEFAULT NULL,
  `level` tinyint(4) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `transactions`
--

INSERT INTO `transactions` (`id`, `user_id`, `type`, `amount`, `level`, `description`, `created_at`) VALUES
(1, 1, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 16:24:31'),
(2, 2, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 16:51:59'),
(3, 3, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 17:02:17'),
(4, 4, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 17:05:28'),
(5, 5, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 17:12:47'),
(6, 434580, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 5', '2025-12-10 17:12:47'),
(7, 6, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 17:15:59'),
(8, 7, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-10 17:29:56'),
(9, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 7', '2025-12-10 17:29:56'),
(10, 8, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 10:06:48'),
(11, 7, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 8', '2025-12-11 10:06:48'),
(12, 6, 'commission', '1600.00', 2, 'Level 2 commission from new user ID: 8', '2025-12-11 10:06:48'),
(13, 9, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 10:11:17'),
(14, 8, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 9', '2025-12-11 10:11:17'),
(15, 7, 'commission', '1600.00', 2, 'Level 2 commission from new user ID: 9', '2025-12-11 10:11:17'),
(16, 6, 'commission', '800.00', 3, 'Level 3 commission from new user ID: 9', '2025-12-11 10:11:17'),
(17, 10, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 10:15:10'),
(18, 9, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 10', '2025-12-11 10:15:10'),
(19, 8, 'commission', '1600.00', 2, 'Level 2 commission from new user ID: 10', '2025-12-11 10:15:10'),
(20, 7, 'commission', '800.00', 3, 'Level 3 commission from new user ID: 10', '2025-12-11 10:15:10'),
(21, 11, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 11:11:34'),
(22, 12, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 11:14:04'),
(23, 13, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 11:17:04'),
(24, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 13', '2025-12-11 11:17:04'),
(25, 14, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 11:44:14'),
(26, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 14', '2025-12-11 11:44:14'),
(27, 6, '', '8000.00', NULL, 'Recurring deduction for monthly system cycle', '2025-12-11 12:57:28'),
(28, 15, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 13:00:34'),
(29, 7, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 15', '2025-12-11 13:00:34'),
(30, 6, 'commission', '1600.00', 2, 'Level 2 commission from new user ID: 15', '2025-12-11 13:00:34'),
(31, 16, 'registration', '8000.00', NULL, 'Registration fee paid via Flutterwave', '2025-12-11 13:02:24'),
(32, 7, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 16', '2025-12-11 13:02:24'),
(33, 6, 'commission', '1600.00', 2, 'Level 2 commission from new user ID: 16', '2025-12-11 13:02:24'),
(34, 7, '', '8000.00', NULL, 'Recurring deduction for monthly system cycle', '2025-12-11 13:03:11'),
(35, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 7', '2025-12-11 13:03:11'),
(36, 6, '', '8000.00', NULL, 'Recurring deduction for monthly system cycle', '2025-12-11 13:04:31'),
(37, 7, '', '8000.00', NULL, 'Recurring deduction', '2025-12-11 13:33:30'),
(38, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 7', '2025-12-11 13:33:30'),
(39, 6, '', '8000.00', NULL, 'Recurring deduction', '2025-12-11 13:41:46'),
(40, 7, '', '8000.00', NULL, 'Recurring deduction', '2025-12-11 13:41:47'),
(41, 6, 'commission', '5600.00', 1, 'Level 1 commission from new user ID: 7', '2025-12-11 13:41:47');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `unique_id` varchar(60) DEFAULT NULL,
  `fullname` varchar(150) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `gender` enum('male','female','other') DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `referred_by` int(11) DEFAULT NULL,
  `wallet_balance` decimal(12,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `unique_id`, `fullname`, `phone`, `address`, `gender`, `state`, `referred_by`, `wallet_balance`, `created_at`) VALUES
(6, 'HHI490057', 'Stephen Sidikat', '09151436827', '15, Badejoko off Sun breaker, Ondo state', 'female', 'Ogun', 0, '5600.00', '2025-12-10 17:15:59'),
(7, 'HHI967314', 'Temidayo Adeyeye', '+2348033516058', '15, Badejoko Ondo, Ondo state', 'female', 'Ondo', 6, '0.00', '2025-12-10 17:29:56'),
(8, 'HHI146808', 'joshu', '07074245414', '542 Namdi street', 'male', 'Niger', 7, '7200.00', '2025-12-11 10:06:48'),
(9, 'HHI641006', 'ella', '+2348107411589', '15, Badejoko Ondo, Ondo state', 'male', 'Ondo', 8, '5600.00', '2025-12-11 10:11:17'),
(10, 'HHI429395', 'Stephen so', '08162154285', '15, Badejoko off Sun breaker, Ondo state', 'female', 'Ondo', 9, '0.00', '2025-12-11 10:15:10'),
(13, 'HHI847591', 'Johnson Gilbert', '+234912562842', '15, Ikeja Lagos', 'female', 'Lagos', 6, '0.00', '2025-12-11 11:17:04'),
(14, 'HHI451935', 'Temidayo Adeyeye', '+234810741589', '15, Badejoko Ondo, Ondo state', 'female', 'Ondo', 6, '0.00', '2025-12-11 11:44:14'),
(15, 'HHI428887', 'Omowumi Bighead', '08063182148', '15, Badejoko Ondo, Ondo state', 'male', 'Ondo', 7, '0.00', '2025-12-11 13:00:34'),
(16, 'HHI138067', 'omowumi suberu', '07057663207', '15, Badejoko off Sun breaker, Ondo state', 'male', 'Ondo', 7, '0.00', '2025-12-11 13:02:24');

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

--
-- Indexes for table `pending_registrations`
--
ALTER TABLE `pending_registrations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `tx_ref` (`tx_ref`),
  ADD UNIQUE KEY `phone` (`phone`);

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

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

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`unique_id`),
  ADD UNIQUE KEY `phone` (`phone`),
  ADD UNIQUE KEY `phone_2` (`phone`);

--
-- AUTO_INCREMENT for table `auto_deductions`
--
ALTER TABLE `auto_deductions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pending_registrations`
--
ALTER TABLE `pending_registrations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `rewards`
--
ALTER TABLE `rewards`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- Constraints for dumped tables
--

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

