38451-vm/database_full.sql
2026-02-19 11:32:11 +00:00

321 lines
11 KiB
SQL

/*M!999999\- enable the sandbox mode */
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: app_38451
-- ------------------------------------------------------
-- Server version 10.11.14-MariaDB-0+deb12u2
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
SET FOREIGN_KEY_CHECKS = 0;
--
-- Table structure for table `admins`
--
DROP TABLE IF EXISTS `admins`;
CREATE TABLE `admins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password_hash` varchar(255) NOT NULL,
`role` varchar(20) DEFAULT 'admin',
`created_at` timestamp NULL DEFAULT current_timestamp(),
`is_agent` tinyint(4) DEFAULT 0,
`permissions` text DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `admins` (`id`, `username`, `password_hash`, `role`) VALUES (1,'admin','$2y$10$uJvcqHNb.naRWj.apBapi.C.fF2zaIbMhYEtVdGmmVUWZkQi9ESfe','admin');
--
-- Table structure for table `binary_orders`
--
DROP TABLE IF EXISTS `binary_orders`;
CREATE TABLE `binary_orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`symbol` varchar(20) NOT NULL,
`direction` varchar(10) DEFAULT NULL,
`amount` decimal(20,8) NOT NULL,
`duration` int(11) NOT NULL,
`profit_rate` decimal(5,2) NOT NULL,
`entry_price` decimal(20,8) NOT NULL,
`close_price` decimal(20,8) DEFAULT NULL,
`status` enum('pending','won','lost','cancelled') DEFAULT 'pending',
`control_status` tinyint(4) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`end_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `contract_orders`
--
DROP TABLE IF EXISTS `contract_orders`;
CREATE TABLE `contract_orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`symbol` varchar(20) NOT NULL,
`type` enum('limit','market') DEFAULT 'market',
`direction` varchar(10) DEFAULT NULL,
`leverage` int(11) DEFAULT 1,
`amount` decimal(20,8) NOT NULL,
`entry_price` decimal(20,8) DEFAULT NULL,
`close_price` decimal(20,8) DEFAULT NULL,
`status` enum('open','closed','cancelled') DEFAULT 'open',
`profit` decimal(20,8) DEFAULT 0.00000000,
`control_status` tinyint(4) DEFAULT 0,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `exchange_records`
--
DROP TABLE IF EXISTS `exchange_records`;
CREATE TABLE `exchange_records` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`from_symbol` varchar(10) NOT NULL,
`to_symbol` varchar(10) NOT NULL,
`from_amount` decimal(20,8) NOT NULL,
`to_amount` decimal(20,8) NOT NULL,
`rate` decimal(20,8) NOT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `finance_requests`
--
DROP TABLE IF EXISTS `finance_requests`;
CREATE TABLE `finance_requests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`type` enum('recharge','withdrawal') NOT NULL,
`amount` decimal(20,8) NOT NULL,
`symbol` varchar(10) DEFAULT 'USDT',
`status` enum('pending','approved','rejected') DEFAULT 'pending',
`payment_method` varchar(50) DEFAULT NULL,
`payment_details` text DEFAULT NULL,
`rejection_reason` text DEFAULT NULL,
`tx_hash` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`fiat_amount` decimal(20,2) DEFAULT NULL,
`fiat_currency` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `messages`
--
DROP TABLE IF EXISTS `messages`;
CREATE TABLE `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`admin_id` int(11) DEFAULT NULL,
`sender` enum('user','admin') DEFAULT NULL,
`message` text DEFAULT NULL,
`ip_address` varchar(45) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `price_controls`
--
DROP TABLE IF EXISTS `price_controls`;
CREATE TABLE `price_controls` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`symbol` varchar(20) NOT NULL,
`target_price` decimal(20,8) NOT NULL,
`execution_time` timestamp NOT NULL,
`duration` int(11) DEFAULT 60,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `spot_orders`
--
DROP TABLE IF EXISTS `spot_orders`;
CREATE TABLE `spot_orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`symbol` varchar(20) NOT NULL,
`side` enum('buy','sell') NOT NULL,
`price` decimal(20,8) DEFAULT NULL,
`amount` decimal(20,8) NOT NULL,
`filled` decimal(20,8) DEFAULT 0.00000000,
`status` enum('pending','filled','cancelled') DEFAULT 'pending',
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `staking_records`
--
DROP TABLE IF EXISTS `staking_records`;
CREATE TABLE `staking_records` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`plan_name` varchar(100) NOT NULL,
`amount` decimal(20,8) NOT NULL,
`symbol` varchar(10) DEFAULT 'USDT',
`daily_profit` decimal(5,2) NOT NULL,
`period` int(11) NOT NULL,
`status` enum('running','ended') DEFAULT 'running',
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `system_settings`
--
DROP TABLE IF EXISTS `system_settings`;
CREATE TABLE `system_settings` (
`setting_key` varchar(50) NOT NULL,
`setting_value` text DEFAULT NULL,
PRIMARY KEY (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `system_settings` VALUES
('android_download_url','/downloads/byro.apk'),
('apk_download_url','/downloads/byro.apk'),
('email_verification_enabled','0'),
('ios_download_url','/downloads/byro.apk'),
('mail_from_email',''),
('mail_from_name','Byro Exchange'),
('service_link',''),
('site_logo','/assets/pasted-20260219-011659-0f2b767b.png'),
('site_name','Byro'),
('smtp_host',''),
('smtp_pass',''),
('smtp_port','587'),
('smtp_secure','tls'),
('smtp_user',''),
('usdt_bep20_address','0x742d35Cc6634C0532925a3b844Bc454e4438f44e'),
('usdt_erc20_address','0x742d35Cc6634C0532925a3b844Bc454e4438f44e'),
('usdt_protocol','TRC20'),
('usdt_recharge_address',''),
('usdt_trc20_address','TYv9V5J1P1eEwz7y3WqJg9M2yv7f7xXv3x');
--
-- Table structure for table `transactions`
--
DROP TABLE IF EXISTS `transactions`;
CREATE TABLE `transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`type` varchar(20) NOT NULL,
`amount` decimal(20,8) NOT NULL,
`symbol` varchar(10) NOT NULL,
`status` varchar(20) DEFAULT 'completed',
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `user_balances`
--
DROP TABLE IF EXISTS `user_balances`;
CREATE TABLE `user_balances` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`symbol` varchar(10) NOT NULL,
`available` decimal(20,8) DEFAULT 0.00000000,
`frozen` decimal(20,8) DEFAULT 0.00000000,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`,`symbol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`password_hash` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`uid` varchar(20) DEFAULT NULL,
`credit_score` int(11) DEFAULT 80,
`real_name_status` int(11) DEFAULT 0,
`role` varchar(20) DEFAULT 'user',
`vip_level` int(11) DEFAULT 0,
`total_recharge` decimal(16,4) DEFAULT 0.0000,
`transaction_password` varchar(255) DEFAULT NULL,
`kyc_name` varchar(100) DEFAULT NULL,
`kyc_id_number` varchar(50) DEFAULT NULL,
`kyc_photo_front` varchar(255) DEFAULT NULL,
`kyc_photo_back` varchar(255) DEFAULT NULL,
`kyc_photo_handheld` varchar(255) DEFAULT NULL,
`kyc_status` int(11) DEFAULT 0,
`registration_ip` varchar(45) DEFAULT NULL,
`status` enum('normal','frozen') DEFAULT 'normal',
`win_loss_control` tinyint(4) DEFAULT 0,
`remark` text DEFAULT NULL,
`kyc_rejection_reason` text DEFAULT NULL,
`agent_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `mining_orders`
--
DROP TABLE IF EXISTS `mining_orders`;
CREATE TABLE `mining_orders` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT NOT NULL,
`symbol` VARCHAR(10) NOT NULL,
`pool_name` VARCHAR(100) NOT NULL,
`amount` DECIMAL(20, 8) NOT NULL,
`apy` DECIMAL(10, 4) NOT NULL,
`period` VARCHAR(20) NOT NULL,
`status` VARCHAR(20) DEFAULT 'running',
`start_time` DATETIME DEFAULT CURRENT_TIMESTAMP,
`end_time` DATETIME,
`last_payout` DATETIME DEFAULT CURRENT_TIMESTAMP,
`total_profit` DECIMAL(20, 8) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `chat_visitors`
--
DROP TABLE IF EXISTS `chat_visitors`;
CREATE TABLE `chat_visitors` (
`user_id` int(11) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`last_ping` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`user_id`,`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `chat_remarks`
--
DROP TABLE IF EXISTS `chat_remarks`;
CREATE TABLE `chat_remarks` (
`user_id` int(11) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`remark` text DEFAULT NULL,
PRIMARY KEY (`user_id`,`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SET FOREIGN_KEY_CHECKS = 1;