-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Feb 27, 2026 at 01:56 PM
-- Server version: 11.4.10-MariaDB-log
-- PHP Version: 8.4.17

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bahoosha_bots_money`
--

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

--
-- Table structure for table `daily_profits`
--

CREATE TABLE `daily_profits` (
  `id` int(11) NOT NULL,
  `investment_id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `amount` decimal(20,8) NOT NULL,
  `profit_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `investments` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `plan_type` int(11) NOT NULL,
  `amount` decimal(20,8) NOT NULL,
  `profit_percent` decimal(5,2) NOT NULL,
  `daily_profit` decimal(20,8) NOT NULL,
  `total_profit` decimal(20,8) DEFAULT 0.00000000,
  `last_profit_date` date DEFAULT NULL,
  `status` varchar(20) DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `nowpayments`
--

CREATE TABLE `nowpayments` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `order_id` varchar(100) DEFAULT NULL,
  `payment_id` bigint(20) DEFAULT NULL,
  `amount` decimal(20,8) DEFAULT NULL,
  `plan_type` int(11) DEFAULT NULL,
  `pay_currency` varchar(20) DEFAULT NULL,
  `pay_amount` decimal(20,8) DEFAULT NULL,
  `pay_address` text DEFAULT NULL,
  `payment_status` varchar(50) DEFAULT 'waiting',
  `actually_paid` decimal(20,8) DEFAULT 0.00000000,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `referrals`
--

CREATE TABLE `referrals` (
  `id` int(11) NOT NULL,
  `referrer_id` bigint(20) NOT NULL,
  `referred_id` bigint(20) NOT NULL,
  `commission_earned` decimal(20,8) DEFAULT 0.00000000,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `referrals`
--

INSERT INTO `referrals` (`id`, `referrer_id`, `referred_id`, `commission_earned`, `created_at`) VALUES
(1, 5906721090, 7437651713, 0.00000000, '2026-02-18 07:58:14'),
(2, 6436332266, 8043234541, 0.00000000, '2026-02-20 10:45:15');

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

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

CREATE TABLE `transactions` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `type` varchar(50) NOT NULL,
  `amount` decimal(20,8) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `username` varchar(255) DEFAULT NULL,
  `first_name` varchar(255) DEFAULT NULL,
  `language` varchar(5) DEFAULT 'fa',
  `referrer_id` bigint(20) DEFAULT NULL,
  `referral_code` varchar(50) DEFAULT NULL,
  `balance` decimal(20,8) DEFAULT 0.00000000,
  `total_deposit` decimal(20,8) DEFAULT 0.00000000,
  `total_profit` decimal(20,8) DEFAULT 0.00000000,
  `referral_earnings` decimal(20,8) DEFAULT 0.00000000,
  `last_withdraw_date` date DEFAULT NULL,
  `is_blocked` tinyint(1) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users` (`id`, `user_id`, `username`, `first_name`, `language`, `referrer_id`, `referral_code`, `balance`, `total_deposit`, `total_profit`, `referral_earnings`, `last_withdraw_date`, `is_blocked`, `created_at`) VALUES
(1, 81706506, 'Shazdeh021', 'รђคz๔єђ', 'fa', NULL, 'REF0959075B', 200.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-15 07:01:38'),
(2, 6436332266, 'kolonel021', 'shazdeh', 'fa', NULL, 'REFC55D74DC', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-15 08:07:04'),
(3, 5603451242, 'sinaa_akbarzadeh', 'Sina', 'fa', NULL, 'REFC388DAAB', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-15 23:20:29'),
(4, 5906721090, 'nft_admin26', 'ان اف تی سیگنال', 'fa', NULL, 'REF232040F2', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-16 08:53:55'),
(5, 7437651713, 'amir26377', 'Amir', 'fa', 5906721090, 'REF2B928B61', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-18 07:58:14'),
(6, 8043234541, 'azmove4', '👣', 'fa', 6436332266, 'REF40662483', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-20 10:45:15'),
(7, 8282993558, '', 'Arbaz', 'fa', NULL, 'REF2F24C30F', 0.00000000, 0.00000000, 0.00000000, 0.00000000, NULL, 0, '2026-02-25 07:40:51');

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

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

CREATE TABLE `withdrawals` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `amount` decimal(20,8) NOT NULL,
  `wallet_address` text DEFAULT NULL,
  `status` varchar(20) DEFAULT 'pending',
  `admin_note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `daily_profits`
--
ALTER TABLE `daily_profits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `investment_id` (`investment_id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_profit_date` (`profit_date`);

--
-- Indexes for table `investments`
--
ALTER TABLE `investments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `nowpayments`
--
ALTER TABLE `nowpayments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `order_id` (`order_id`),
  ADD KEY `idx_order_id` (`order_id`),
  ADD KEY `idx_payment_id` (`payment_id`),
  ADD KEY `idx_user_id` (`user_id`);

--
-- Indexes for table `referrals`
--
ALTER TABLE `referrals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_referrer_id` (`referrer_id`),
  ADD KEY `idx_referred_id` (`referred_id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_type` (`type`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_id` (`user_id`),
  ADD UNIQUE KEY `referral_code` (`referral_code`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_referral_code` (`referral_code`),
  ADD KEY `idx_language` (`language`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `daily_profits`
--
ALTER TABLE `daily_profits`
  ADD CONSTRAINT `daily_profits_ibfk_1` FOREIGN KEY (`investment_id`) REFERENCES `investments` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
