-- Finorix Platform MySQL Dump
-- Generated on 2026-05-08 12:05:48


-- Table structure for table `migrations`
CREATE TABLE `migrations` (`id` integer primary key autoincrement not null, `migration` varchar not null, `batch` integer not null);

-- Dumping data for table `migrations`
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('1', '0001_01_01_000000_create_users_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('2', '0001_01_01_000001_create_cache_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('3', '0001_01_01_000002_create_jobs_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('4', '2026_05_07_020822_create_affiliates_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('5', '2026_05_07_020822_create_trades_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('6', '2026_05_07_020823_create_commissions_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('7', '2026_05_07_020824_create_withdrawals_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('8', '2026_05_07_020825_create_ledgers_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('9', '2026_05_07_020831_add_trading_fields_to_users_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('10', '2026_05_07_022320_create_personal_access_tokens_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('11', '2026_05_07_031017_add_username_to_users_table', '2');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('12', '2026_05_07_045940_add_affiliate_approval_to_users_table', '3');

-- Dumping data for table `password_reset_tokens`
-- Table structure for table `sessions`
CREATE TABLE `sessions` (`id` varchar not null, `user_id` integer, `ip_address` varchar, `user_agent` text, `payload` text not null, `last_activity` integer not null, primary key (`id`));

-- Dumping data for table `sessions`
INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES ('YJUitlBqTq0TfiGuyUsLlsKGwo4YbqsevUI3HMAp', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiM3BNUmZJeFM0dGZKbndRdEhlMk9DMTIzRG43MVBpZGo2V2ZMVlBjOCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', '1778127161');
INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES ('6zhjPXvA2SmYsBC1D0khWbqJDmoomC0lNthAHz5A', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiWVZjQ3hiV3B2YU5wTXp6d1c2N3R1WGkxZVdSejVDM0JtWWpBUUFrRCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', '1778229648');

-- Dumping data for table `cache_locks`
-- Table structure for table `jobs`
CREATE TABLE `jobs` (`id` integer primary key autoincrement not null, `queue` varchar not null, `payload` text not null, `attempts` integer not null, `reserved_at` integer, `available_at` integer not null, `created_at` integer not null);

-- Dumping data for table `jobs`
-- Table structure for table `job_batches`
CREATE TABLE `job_batches` (`id` varchar not null, `name` varchar not null, `total_jobs` integer not null, `pending_jobs` integer not null, `failed_jobs` integer not null, `failed_job_ids` text not null, `options` text, `cancelled_at` integer, `created_at` integer not null, `finished_at` integer, primary key (`id`));

-- Dumping data for table `job_batches`
-- Table structure for table `failed_jobs`
CREATE TABLE `failed_jobs` (`id` integer primary key autoincrement not null, `uuid` varchar not null, `connection` text not null, `queue` text not null, `payload` text not null, `exception` text not null, `failed_at` datetime not null default CURRENT_TIMESTAMP);

-- Dumping data for table `failed_jobs`
-- Table structure for table `affiliates`
CREATE TABLE `affiliates` (`id` integer primary key autoincrement not null, `user_id` integer not null, `model` varchar check (`model` in ('revshare', 'turnover')) not null default 'revshare', `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade);

-- Dumping data for table `affiliates`
INSERT INTO `affiliates` (`id`, `user_id`, `model`, `created_at`, `updated_at`) VALUES ('1', '2', 'revshare', '2026-05-07 03:10:34', '2026-05-07 03:10:34');
INSERT INTO `affiliates` (`id`, `user_id`, `model`, `created_at`, `updated_at`) VALUES ('2', '3', 'revshare', '2026-05-07 03:10:34', '2026-05-07 03:10:34');
INSERT INTO `affiliates` (`id`, `user_id`, `model`, `created_at`, `updated_at`) VALUES ('3', '4', 'revshare', '2026-05-07 03:10:34', '2026-05-07 03:10:34');

-- Table structure for table `trades`
CREATE TABLE `trades` (`id` integer primary key autoincrement not null, `user_id` integer not null, `asset` varchar not null, `direction` varchar check (`direction` in ('up', 'down')) not null, `amount` numeric not null, `payout_multiplier` numeric not null default '1.85', `payout_amount` numeric not null default '0', `expires_at` datetime not null, `status` varchar check (`status` in ('active', 'won', 'lost')) not null default 'active', `outcome_type` varchar check (`outcome_type` in ('natural', 'forced_win', 'forced_loss')) not null default 'natural', `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade);

-- Dumping data for table `trades`
INSERT INTO `trades` (`id`, `user_id`, `asset`, `direction`, `amount`, `payout_multiplier`, `payout_amount`, `expires_at`, `status`, `outcome_type`, `created_at`, `updated_at`) VALUES ('1', '4', 'BTC/USD', 'up', '100', '1.85', '0', '2026-05-07 03:15:34', 'active', 'natural', '2026-05-07 03:10:35', '2026-05-07 03:10:35');
INSERT INTO `trades` (`id`, `user_id`, `asset`, `direction`, `amount`, `payout_multiplier`, `payout_amount`, `expires_at`, `status`, `outcome_type`, `created_at`, `updated_at`) VALUES ('2', '4', 'ETH/USD', 'down', '200', '1.85', '0', '2026-05-07 03:00:35', 'lost', 'natural', '2026-05-07 03:10:35', '2026-05-07 03:10:35');
INSERT INTO `trades` (`id`, `user_id`, `asset`, `direction`, `amount`, `payout_multiplier`, `payout_amount`, `expires_at`, `status`, `outcome_type`, `created_at`, `updated_at`) VALUES ('3', '3', 'XAU/USD', 'up', '50', '1.9', '95', '2026-05-07 02:50:35', 'won', 'natural', '2026-05-07 03:10:35', '2026-05-07 03:10:35');

-- Table structure for table `commissions`
CREATE TABLE `commissions` (`id` integer primary key autoincrement not null, `affiliate_id` integer not null, `user_id` integer not null, `trade_id` integer not null, `amount` numeric not null, `percentage` numeric not null, `level` varchar check (`level` in ('1', '2')) not null, `type` varchar check (`type` in ('revshare', 'turnover')) not null, `created_at` datetime, `updated_at` datetime, foreign key(`affiliate_id`) references `users`(`id`) on delete cascade, foreign key(`user_id`) references `users`(`id`) on delete cascade, foreign key(`trade_id`) references `trades`(`id`) on delete cascade);

-- Dumping data for table `commissions`
-- Table structure for table `withdrawals`
CREATE TABLE `withdrawals` (`id` integer primary key autoincrement not null, `user_id` integer not null, `amount` numeric not null, `method` varchar not null, `wallet_address` varchar, `status` varchar check (`status` in ('pending', 'approved', 'rejected')) not null default 'pending', `processed_by` varchar, `processed_at` datetime, `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade);

-- Dumping data for table `withdrawals`
-- Table structure for table `ledgers`
CREATE TABLE `ledgers` (`id` integer primary key autoincrement not null, `user_id` integer not null, `amount` numeric not null, `balance_before` numeric not null, `balance_after` numeric not null, `type` varchar not null, `reference_type` varchar, `reference_id` integer, `description` varchar, `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade);

-- Dumping data for table `personal_access_tokens`
