-- =====================================================
-- TELEGRAM INVESTMENT BOT - PRODUCTION DATABASE SCHEMA
-- =====================================================
-- Database: telegram_investment_bot
-- Engine: InnoDB
-- Charset: utf8mb4
-- Collation: utf8mb4_unicode_ci
-- 
-- This version is optimized for shared hosting (Hostinger, etc.)
-- Removed stored procedures and triggers that require special privileges
-- 
-- IMPORTANT: Create the database in your hosting control panel FIRST
-- Then select it in phpMyAdmin before importing this file
-- =====================================================

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

-- =====================================================
-- TABLE: languages
-- Purpose: Supported languages for multi-language support
-- =====================================================
CREATE TABLE `languages` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `code` VARCHAR(5) NOT NULL COMMENT 'Language code (en, es, fr, etc.)',
  `name` VARCHAR(50) NOT NULL COMMENT 'Language name in English',
  `native_name` VARCHAR(50) NOT NULL COMMENT 'Language name in native script',
  `flag_emoji` VARCHAR(10) DEFAULT NULL COMMENT 'Flag emoji for display',
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_code` (`code`),
  KEY `idx_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: translations
-- Purpose: Translation strings for all languages
-- =====================================================
CREATE TABLE `translations` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `language_code` VARCHAR(5) NOT NULL,
  `trans_key` VARCHAR(100) NOT NULL COMMENT 'Translation key identifier',
  `trans_value` TEXT NOT NULL COMMENT 'Translated text',
  `category` VARCHAR(50) DEFAULT NULL COMMENT 'Grouping category (menu, error, etc.)',
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_lang_key` (`language_code`, `trans_key`),
  KEY `idx_language` (`language_code`),
  KEY `idx_category` (`category`),
  CONSTRAINT `fk_translations_language` FOREIGN KEY (`language_code`) REFERENCES `languages` (`code`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: pages
-- Purpose: Static pages (About, FAQ, Terms) in multiple languages
-- =====================================================
CREATE TABLE `pages` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(50) NOT NULL,
  `language_code` VARCHAR(5) NOT NULL,
  `title` VARCHAR(200) NOT NULL,
  `content` TEXT NOT NULL,
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_slug_lang` (`slug`, `language_code`),
  KEY `idx_slug` (`slug`),
  KEY `idx_language` (`language_code`),
  CONSTRAINT `fk_pages_language` FOREIGN KEY (`language_code`) REFERENCES `languages` (`code`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: users
-- Purpose: Telegram bot users
-- =====================================================
CREATE TABLE `users` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `telegram_id` BIGINT UNSIGNED NOT NULL COMMENT 'Telegram user ID',
  `username` VARCHAR(255) DEFAULT NULL COMMENT 'Telegram username',
  `first_name` VARCHAR(255) DEFAULT NULL,
  `last_name` VARCHAR(255) DEFAULT NULL,
  `language_code` VARCHAR(5) NOT NULL DEFAULT 'en',
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `is_frozen` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Frozen by admin',
  `frozen_at` TIMESTAMP NULL DEFAULT NULL,
  `frozen_by` INT UNSIGNED DEFAULT NULL COMMENT 'Admin user ID',
  `referrer_id` INT UNSIGNED DEFAULT NULL COMMENT 'User who referred this user',
  `referral_code` VARCHAR(20) DEFAULT NULL COMMENT 'Unique referral code',
  `total_referrals` INT UNSIGNED NOT NULL DEFAULT 0,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `last_activity` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_telegram_id` (`telegram_id`),
  UNIQUE KEY `uk_referral_code` (`referral_code`),
  KEY `idx_username` (`username`),
  KEY `idx_active` (`is_active`),
  KEY `idx_frozen` (`is_frozen`),
  KEY `idx_referrer` (`referrer_id`),
  KEY `idx_language` (`language_code`),
  CONSTRAINT `fk_users_language` FOREIGN KEY (`language_code`) REFERENCES `languages` (`code`),
  CONSTRAINT `fk_users_referrer` FOREIGN KEY (`referrer_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: states
-- Purpose: User conversation states for bot flow control
-- =====================================================
CREATE TABLE `states` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `state` VARCHAR(50) NOT NULL DEFAULT 'idle',
  `context` JSON DEFAULT NULL COMMENT 'Additional context data for the state',
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user` (`user_id`),
  KEY `idx_state` (`state`),
  CONSTRAINT `fk_states_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: wallets
-- Purpose: Multi-currency wallet balances
-- =====================================================
CREATE TABLE `wallets` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `currency` VARCHAR(10) NOT NULL COMMENT 'BTC, ETH, LTC, USDT, TRX, DASH',
  `balance` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `total_deposited` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `total_withdrawn` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `total_profit` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `total_referral` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user_currency` (`user_id`, `currency`),
  KEY `idx_currency` (`currency`),
  CONSTRAINT `fk_wallets_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: investment_plans
-- Purpose: Investment plans configuration
-- =====================================================
CREATE TABLE `investment_plans` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(100) NOT NULL COMMENT 'Plan name (Capital, Gold, Diamond, Mega)',
  `currency` VARCHAR(10) NOT NULL,
  `min_amount` DECIMAL(20, 8) NOT NULL,
  `max_amount` DECIMAL(20, 8) NOT NULL,
  `roi_percentage` DECIMAL(5, 2) NOT NULL COMMENT 'Return on Investment percentage',
  `duration_days` INT UNSIGNED NOT NULL COMMENT 'Investment duration in days',
  `description` TEXT DEFAULT NULL,
  `display_order` INT UNSIGNED NOT NULL DEFAULT 0,
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_currency` (`currency`),
  KEY `idx_active` (`is_active`),
  KEY `idx_order` (`display_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: investments
-- Purpose: User investments
-- =====================================================
CREATE TABLE `investments` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `plan_id` INT UNSIGNED NOT NULL,
  `currency` VARCHAR(10) NOT NULL,
  `amount` DECIMAL(20, 8) NOT NULL,
  `roi_percentage` DECIMAL(5, 2) NOT NULL,
  `expected_profit` DECIMAL(20, 8) NOT NULL,
  `actual_profit` DECIMAL(20, 8) DEFAULT 0.00000000,
  `status` ENUM('active', 'completed', 'cancelled') NOT NULL DEFAULT 'active',
  `start_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `end_date` TIMESTAMP NULL DEFAULT NULL,
  `completed_at` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user` (`user_id`),
  KEY `idx_plan` (`plan_id`),
  KEY `idx_status` (`status`),
  KEY `idx_dates` (`start_date`, `end_date`),
  CONSTRAINT `fk_investments_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_investments_plan` FOREIGN KEY (`plan_id`) REFERENCES `investment_plans` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: transactions
-- Purpose: All financial transactions
-- =====================================================
CREATE TABLE `transactions` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `type` ENUM('deposit', 'withdrawal', 'profit', 'referral', 'bonus', 'adjustment') NOT NULL,
  `currency` VARCHAR(10) NOT NULL,
  `amount` DECIMAL(20, 8) NOT NULL,
  `balance_before` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `balance_after` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `reference_type` VARCHAR(50) DEFAULT NULL COMMENT 'investments, withdrawals, etc.',
  `reference_id` INT UNSIGNED DEFAULT NULL COMMENT 'Related record ID',
  `description` TEXT DEFAULT NULL,
  `tx_hash` VARCHAR(255) DEFAULT NULL COMMENT 'Blockchain transaction hash',
  `status` ENUM('pending', 'completed', 'failed') NOT NULL DEFAULT 'completed',
  `created_by` INT UNSIGNED DEFAULT NULL COMMENT 'Admin user ID if manual',
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user` (`user_id`),
  KEY `idx_type` (`type`),
  KEY `idx_currency` (`currency`),
  KEY `idx_status` (`status`),
  KEY `idx_reference` (`reference_type`, `reference_id`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `fk_transactions_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: deposit_addresses
-- Purpose: System-owned deposit addresses pool
-- =====================================================
CREATE TABLE `deposit_addresses` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `currency` VARCHAR(10) NOT NULL,
  `address` VARCHAR(255) NOT NULL,
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `label` VARCHAR(100) DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_currency_address` (`currency`, `address`),
  KEY `idx_currency` (`currency`),
  KEY `idx_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: deposit_requests
-- Purpose: User deposit requests awaiting admin approval
-- =====================================================
CREATE TABLE `deposit_requests` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `plan_id` INT UNSIGNED NOT NULL,
  `currency` VARCHAR(10) NOT NULL,
  `amount` DECIMAL(20, 8) NOT NULL,
  `deposit_address_id` INT UNSIGNED DEFAULT NULL,
  `proof_image` VARCHAR(255) DEFAULT NULL COMMENT 'Optional payment proof',
  `status` ENUM('pending', 'approved', 'rejected') NOT NULL DEFAULT 'pending',
  `admin_notes` TEXT DEFAULT NULL,
  `processed_by` INT UNSIGNED DEFAULT NULL COMMENT 'Admin user ID',
  `processed_at` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user` (`user_id`),
  KEY `idx_plan` (`plan_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `fk_deposit_requests_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_deposit_requests_plan` FOREIGN KEY (`plan_id`) REFERENCES `investment_plans` (`id`),
  CONSTRAINT `fk_deposit_requests_address` FOREIGN KEY (`deposit_address_id`) REFERENCES `deposit_addresses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: withdrawal_addresses
-- Purpose: User-registered withdrawal addresses
-- =====================================================
CREATE TABLE `withdrawal_addresses` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `currency` VARCHAR(10) NOT NULL,
  `address` VARCHAR(255) NOT NULL,
  `label` VARCHAR(100) DEFAULT NULL,
  `is_verified` TINYINT(1) NOT NULL DEFAULT 0,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user_currency` (`user_id`, `currency`),
  KEY `idx_currency` (`currency`),
  CONSTRAINT `fk_withdrawal_addresses_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: withdrawal_requests
-- Purpose: User withdrawal requests
-- =====================================================
CREATE TABLE `withdrawal_requests` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` INT UNSIGNED NOT NULL,
  `currency` VARCHAR(10) NOT NULL,
  `amount` DECIMAL(20, 8) NOT NULL,
  `fee` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `net_amount` DECIMAL(20, 8) NOT NULL COMMENT 'Amount after fee',
  `withdrawal_address` VARCHAR(255) NOT NULL,
  `status` ENUM('pending', 'approved', 'rejected', 'paid') NOT NULL DEFAULT 'pending',
  `admin_notes` TEXT DEFAULT NULL,
  `tx_hash` VARCHAR(255) DEFAULT NULL COMMENT 'Blockchain transaction hash',
  `processed_by` INT UNSIGNED DEFAULT NULL COMMENT 'Admin user ID',
  `processed_at` TIMESTAMP NULL DEFAULT NULL,
  `paid_at` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `fk_withdrawal_requests_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: referrals
-- Purpose: Referral tracking and commission records
-- =====================================================
CREATE TABLE `referrals` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `referrer_id` INT UNSIGNED NOT NULL COMMENT 'User who referred',
  `referred_id` INT UNSIGNED NOT NULL COMMENT 'User who was referred',
  `level` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Referral level (1, 2, 3...)',
  `commission_earned` DECIMAL(20, 8) NOT NULL DEFAULT 0.00000000,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_referrer` (`referrer_id`),
  KEY `idx_referred` (`referred_id`),
  KEY `idx_level` (`level`),
  CONSTRAINT `fk_referrals_referrer` FOREIGN KEY (`referrer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_referrals_referred` FOREIGN KEY (`referred_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: admin_users
-- Purpose: Admin panel users
-- =====================================================
CREATE TABLE `admin_users` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `username` VARCHAR(50) NOT NULL,
  `password_hash` VARCHAR(255) NOT NULL,
  `email` VARCHAR(255) DEFAULT NULL,
  `role` ENUM('super_admin', 'admin', 'moderator') NOT NULL DEFAULT 'admin',
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `last_login` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_username` (`username`),
  KEY `idx_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: admin_logs
-- Purpose: Admin activity logging
-- =====================================================
CREATE TABLE `admin_logs` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `admin_id` INT UNSIGNED NOT NULL,
  `action` VARCHAR(100) NOT NULL,
  `description` TEXT DEFAULT NULL,
  `ip_address` VARCHAR(45) DEFAULT NULL,
  `user_agent` VARCHAR(255) DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_admin` (`admin_id`),
  KEY `idx_action` (`action`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `fk_admin_logs_admin` FOREIGN KEY (`admin_id`) REFERENCES `admin_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- TABLE: system_settings
-- Purpose: System-wide configuration
-- =====================================================
CREATE TABLE `system_settings` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `setting_key` VARCHAR(100) NOT NULL,
  `setting_value` TEXT NOT NULL,
  `setting_type` ENUM('string', 'number', 'boolean', 'json') NOT NULL DEFAULT 'string',
  `description` VARCHAR(255) DEFAULT NULL,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_setting_key` (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =====================================================
-- PERFORMANCE INDEXES
-- =====================================================
CREATE INDEX idx_investments_user_status ON investments(user_id, status);
CREATE INDEX idx_transactions_user_type ON transactions(user_id, type, created_at);
CREATE INDEX idx_withdrawal_requests_status_created ON withdrawal_requests(status, created_at);
CREATE INDEX idx_deposit_requests_status_created ON deposit_requests(status, created_at);

-- =====================================================
-- NOTE: Stored procedures and triggers removed for shared hosting compatibility
-- The application handles all business logic in PHP code
-- =====================================================

-- End of production schema
