-- Create blogs table
CREATE TABLE IF NOT EXISTS `blogs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `content` longtext NOT NULL,
  `excerpt` text DEFAULT NULL,
  `featured_image` varchar(255) DEFAULT NULL,
  `category` varchar(100) DEFAULT 'general',
  `tags` text DEFAULT NULL,
  `status` enum('draft','published','archived') DEFAULT 'draft',
  `views` int(11) DEFAULT 0,
  `author_id` int(11) DEFAULT 1,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `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 `slug` (`slug`),
  KEY `status` (`status`),
  KEY `category` (`category`),
  KEY `created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Insert sample blog posts
INSERT INTO `blogs` (`title`, `slug`, `content`, `excerpt`, `category`, `tags`, `status`, `views`, `meta_title`, `meta_description`) VALUES
('Ultimate Guide to Satta Matka Winning Strategies', 'ultimate-guide-satta-matka-winning-strategies', 
'<h2>Introduction to Satta Matka</h2>
<p>Satta Matka is one of India''s most popular gambling games that originated in the 1960s. What started as a simple lottery has evolved into a sophisticated betting system with multiple markets and strategies.</p>

<h3>Understanding the Basics</h3>
<p>Before diving into winning strategies, it''s crucial to understand the fundamentals:</p>
<ul>
<li><strong>Single:</strong> Betting on a single number (0-9)</li>
<li><strong>Jodi/Pair:</strong> Betting on a pair of numbers (00-99)</li>
<li><strong>Panna/Patti:</strong> Three-digit numbers with specific patterns</li>
<li><strong>Half Sangam:</strong> Combination of open and close results</li>
<li><strong>Full Sangam:</strong> Combination of both panna results</li>
</ul>

<h3>Popular Matka Markets</h3>
<p>The most trusted and popular markets include:</p>
<ul>
<li>Kalyan Matka - The king of all matka games</li>
<li>Main Mumbai - Traditional and reliable</li>
<li>Rajdhani Day/Night - High payout rates</li>
<li>Milan Day/Night - Consistent results</li>
<li>Time Bazar - Quick results</li>
</ul>

<h3>Winning Strategies</h3>
<h4>1. Mathematical Approach</h4>
<p>Use statistical analysis to identify patterns in previous results. Track the frequency of numbers and look for trends.</p>

<h4>2. Chart Analysis</h4>
<p>Study matka charts regularly. Look for:</p>
<ul>
<li>Hot numbers (frequently appearing)</li>
<li>Cold numbers (rarely appearing)</li>
<li>Number sequences and patterns</li>
</ul>

<h4>3. Money Management</h4>
<p>Never bet more than you can afford to lose. Set daily limits and stick to them.</p>

<h4>4. Start Small</h4>
<p>Begin with small bets to understand the game mechanics before increasing stakes.</p>

<h3>Tips for Beginners</h3>
<ul>
<li>Choose reputable platforms like Shubank</li>
<li>Start with single-digit betting</li>
<li>Learn from experienced players</li>
<li>Keep detailed records of your bets</li>
<li>Never chase losses</li>
</ul>

<h3>Conclusion</h3>
<p>Success in Satta Matka requires patience, discipline, and strategic thinking. Remember that it''s a game of chance, and responsible gaming should always be your priority.</p>', 
'Learn the ultimate strategies and tips for winning at Satta Matka. Comprehensive guide covering basics, markets, and proven winning techniques.', 
'tips', 'satta matka,winning strategies,matka tips,kalyan matka,gambling tips', 'published', 245, 
'Ultimate Satta Matka Winning Strategies - Tips & Tricks', 'Complete guide to Satta Matka winning strategies, tips, and techniques. Learn from experts and improve your game.'),

('How to Read Matka Charts Like a Pro', 'how-to-read-matka-charts-like-pro',
'<h2>Understanding Matka Charts</h2>
<p>Matka charts are the backbone of strategic satta matka playing. Learning to read and interpret these charts can significantly improve your chances of making informed bets.</p>

<h3>Types of Matka Charts</h3>
<h4>1. Kalyan Chart</h4>
<p>The most popular chart showing Kalyan matka results. Updated twice daily with open and close numbers.</p>

<h4>2. Main Mumbai Chart</h4>
<p>Traditional chart for Main Mumbai market. Known for consistent patterns and reliable results.</p>

<h4>3. Rajdhani Chart</h4>
<p>Covers both day and night results for Rajdhani market. High payout ratios make it popular among players.</p>

<h3>Chart Reading Techniques</h3>
<h4>Pattern Recognition</h4>
<p>Look for recurring patterns in the charts:</p>
<ul>
<li>Sequential numbers (1,2,3 or 7,8,9)</li>
<li>Mirror numbers (12,21 or 45,54)</li>
<li>Sum patterns (numbers that add up to specific totals)</li>
</ul>

<h4>Hot and Cold Analysis</h4>
<p>Track number frequencies:</p>
<ul>
<li><strong>Hot Numbers:</strong> Appearing frequently in recent draws</li>
<li><strong>Cold Numbers:</strong> Haven''t appeared for several draws</li>
<li><strong>Due Numbers:</strong> Expected to appear based on probability</li>
</ul>

<h3>Advanced Chart Strategies</h3>
<h4>Cross Market Analysis</h4>
<p>Compare patterns across different markets to identify correlations and trends.</p>

<h4>Time-Based Patterns</h4>
<p>Some numbers show preference for specific days of the week or times of the month.</p>

<h3>Tools for Chart Analysis</h3>
<ul>
<li>Digital chart applications</li>
<li>Statistical calculators</li>
<li>Pattern recognition software</li>
<li>Historical data archives</li>
</ul>

<h3>Common Mistakes to Avoid</h3>
<ul>
<li>Over-relying on patterns</li>
<li>Ignoring probability basics</li>
<li>Following charts blindly</li>
<li>Not maintaining personal records</li>
</ul>

<h3>Conclusion</h3>
<p>Chart reading is an art that improves with practice. Combine chart analysis with sound money management for the best results.</p>',
'Master the art of reading matka charts with professional techniques and strategies. Learn pattern recognition and analysis methods.',
'strategies', 'matka charts,chart reading,kalyan chart,pattern analysis,matka strategies', 'published', 189,
'How to Read Matka Charts Like a Pro - Complete Guide', 'Learn professional matka chart reading techniques, pattern recognition, and analysis strategies for better results.'),

('Shubank vs Other Platforms: Why We''re Different', 'shubank-vs-other-platforms-why-different',
'<h2>Why Choose Shubank?</h2>
<p>In the crowded world of online matka platforms, Shubank stands out as India''s most trusted and reliable choice. Here''s what makes us different.</p>

<h3>Security First Approach</h3>
<h4>Advanced Encryption</h4>
<p>We use bank-grade SSL encryption to protect all user data and transactions. Your personal information and financial details are completely secure.</p>

<h4>Licensed Operations</h4>
<p>Shubank operates under proper licensing and regulatory compliance, ensuring fair play and legal operations.</p>

<h3>Transparent Gaming</h3>
<h4>Real-Time Results</h4>
<p>All results are displayed in real-time with complete transparency. No manipulation, no delays.</p>

<h4>Live Draw Streaming</h4>
<p>Watch live draws for major markets to ensure complete fairness and transparency.</p>

<h3>User-Friendly Features</h3>
<h4>Mobile-First Design</h4>
<p>Our platform is optimized for mobile devices, allowing you to play anywhere, anytime.</p>

<h4>24/7 Customer Support</h4>
<p>Round-the-clock customer support through multiple channels including chat, email, and phone.</p>

<h3>Fast Payments</h3>
<h4>Instant Deposits</h4>
<p>Deposits are processed instantly through multiple payment methods including UPI, bank transfer, and digital wallets.</p>

<h4>Quick Withdrawals</h4>
<p>Withdrawals are processed within minutes, not hours or days like other platforms.</p>

<h3>Competitive Rates</h3>
<h4>Best Payout Ratios</h4>
<p>We offer industry-leading payout ratios:</p>
<ul>
<li>Single: 1:9.5</li>
<li>Jodi: 1:95</li>
<li>Single Panna: 1:140</li>
<li>Double Panna: 1:280</li>
<li>Triple Panna: 1:700</li>
</ul>

<h4>No Hidden Charges</h4>
<p>What you see is what you get. No hidden fees or charges on deposits or withdrawals.</p>

<h3>Educational Resources</h3>
<h4>Free Tips and Strategies</h4>
<p>Access our extensive library of matka tips, strategies, and educational content.</p>

<h4>Chart Analysis Tools</h4>
<p>Use our advanced chart analysis tools to make informed betting decisions.</p>

<h3>Community Features</h3>
<h4>Player Forums</h4>
<p>Connect with other players, share strategies, and learn from experienced matka players.</p>

<h4>Expert Predictions</h4>
<p>Get insights from matka experts and experienced players in our community.</p>

<h3>Responsible Gaming</h3>
<h4>Self-Limit Tools</h4>
<p>Set daily, weekly, or monthly limits on your deposits and bets.</p>

<h4>Reality Check</h4>
<p>Regular reminders about time spent and money wagered to promote responsible gaming.</p>

<h3>What Our Users Say</h3>
<blockquote>
<p>"Shubank has been my go-to platform for 2 years. Fast payouts, fair games, and excellent support." - Rajesh K.</p>
</blockquote>

<blockquote>
<p>"The mobile app is fantastic. I can play and check results on the go." - Priya S.</p>
</blockquote>

<h3>Join the Shubank Family</h3>
<p>Experience the difference that trust, transparency, and technology can make. Join thousands of satisfied players who have made Shubank their preferred matka platform.</p>

<p><strong>Ready to start? <a href="/users.php">Sign up now</a> and get a welcome bonus!</strong></p>',
'Discover what makes Shubank different from other matka platforms. Security, transparency, fast payments, and excellent user experience.',
'platform', 'shubank,online matka,secure platform,fast payments,best matka site', 'published', 312,
'Shubank vs Others - Why We''re India''s Best Matka Platform', 'Compare Shubank with other matka platforms. Learn about our security, transparency, fast payments, and user-friendly features.');

-- Create blog categories table
CREATE TABLE IF NOT EXISTS `blog_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Insert default categories
INSERT INTO `blog_categories` (`name`, `slug`, `description`) VALUES
('Tips & Strategies', 'tips', 'Winning strategies and professional tips for matka gaming'),
('Market Analysis', 'analysis', 'In-depth analysis of various matka markets and trends'),
('Platform Updates', 'platform', 'Latest updates and features about Shubank platform'),
('Educational', 'educational', 'Educational content for beginners and advanced players'),
('News & Updates', 'news', 'Latest news and updates from the matka world');

-- Add indexes for better performance
ALTER TABLE `blogs` ADD INDEX `idx_status_category` (`status`, `category`);
ALTER TABLE `blogs` ADD INDEX `idx_views` (`views`);
ALTER TABLE `blogs` ADD FULLTEXT `idx_search` (`title`, `content`, `tags`);

-- Update blogs table if it exists but missing columns
ALTER TABLE `blogs` 
ADD COLUMN IF NOT EXISTS `slug` varchar(255) AFTER `title`,
ADD COLUMN IF NOT EXISTS `excerpt` text AFTER `content`,
ADD COLUMN IF NOT EXISTS `meta_title` varchar(255) AFTER `author_id`,
ADD COLUMN IF NOT EXISTS `meta_description` text AFTER `meta_title`;

-- Make slug unique if not already
ALTER TABLE `blogs` ADD UNIQUE KEY IF NOT EXISTS `slug` (`slug`);