-- MySQL dump 10.13  Distrib 8.0.42, for Linux (x86_64)
--
-- Host: localhost    Database: ukdataservices
-- ------------------------------------------------------
-- Server version	8.0.42-0ubuntu0.20.04.1

/*!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 */;
/*!50503 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 */;

--
-- Table structure for table `blog_analytics`
--

DROP TABLE IF EXISTS `blog_analytics`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_analytics` (
  `id` int NOT NULL AUTO_INCREMENT,
  `article_id` int DEFAULT NULL,
  `category_id` int DEFAULT NULL,
  `page_type` enum('article','category','index','search') COLLATE utf8mb4_unicode_ci NOT NULL,
  `page_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `referrer` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `search_term` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reading_time_seconds` int DEFAULT NULL,
  `scroll_percentage` int DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `session_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `visited_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `category_id` (`category_id`),
  KEY `idx_article_id` (`article_id`),
  KEY `idx_page_type` (`page_type`),
  KEY `idx_visited_at` (`visited_at`),
  KEY `idx_session_id` (`session_id`),
  CONSTRAINT `blog_analytics_ibfk_1` FOREIGN KEY (`article_id`) REFERENCES `blog_articles` (`id`) ON DELETE SET NULL,
  CONSTRAINT `blog_analytics_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `blog_categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_analytics`
--

LOCK TABLES `blog_analytics` WRITE;
/*!40000 ALTER TABLE `blog_analytics` DISABLE KEYS */;
/*!40000 ALTER TABLE `blog_analytics` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `blog_article_tags`
--

DROP TABLE IF EXISTS `blog_article_tags`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_article_tags` (
  `article_id` int NOT NULL,
  `tag_id` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`article_id`,`tag_id`),
  KEY `tag_id` (`tag_id`),
  CONSTRAINT `blog_article_tags_ibfk_1` FOREIGN KEY (`article_id`) REFERENCES `blog_articles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `blog_article_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `blog_tags` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_article_tags`
--

LOCK TABLES `blog_article_tags` WRITE;
/*!40000 ALTER TABLE `blog_article_tags` DISABLE KEYS */;
INSERT INTO `blog_article_tags` VALUES (1,1,'2025-06-08 10:29:10'),(1,2,'2025-06-08 10:29:10'),(1,5,'2025-06-08 10:29:10'),(1,10,'2025-06-08 10:29:10'),(2,5,'2025-06-08 10:29:10'),(2,6,'2025-06-08 10:29:10'),(2,7,'2025-06-08 10:29:10'),(3,4,'2025-06-08 10:29:10'),(3,8,'2025-06-08 10:29:10'),(3,10,'2025-06-08 10:29:10'),(4,3,'2025-06-08 10:29:10'),(4,4,'2025-06-08 10:29:10'),(4,10,'2025-06-08 10:29:10');
/*!40000 ALTER TABLE `blog_article_tags` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `blog_articles`
--

DROP TABLE IF EXISTS `blog_articles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_articles` (
  `id` int NOT NULL AUTO_INCREMENT,
  `slug` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subtitle` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `excerpt` text COLLATE utf8mb4_unicode_ci,
  `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `featured_image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `category_id` int NOT NULL,
  `author_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'UK Data Services Team',
  `author_title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_title` varchar(160) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_description` varchar(320) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_keywords` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reading_time_minutes` int DEFAULT '5',
  `word_count` int DEFAULT '0',
  `is_published` tinyint(1) DEFAULT '0',
  `is_featured` tinyint(1) DEFAULT '0',
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  UNIQUE KEY `unique_slug` (`slug`),
  KEY `idx_is_published` (`is_published`),
  KEY `idx_is_featured` (`is_featured`),
  KEY `idx_published_at` (`published_at`),
  KEY `idx_category_id` (`category_id`),
  FULLTEXT KEY `search_content` (`title`,`excerpt`,`content`),
  CONSTRAINT `blog_articles_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `blog_categories` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_articles`
--

LOCK TABLES `blog_articles` WRITE;
/*!40000 ALTER TABLE `blog_articles` DISABLE KEYS */;
INSERT INTO `blog_articles` VALUES (1,'web-scraping-compliance-uk-guide','Web Scraping Compliance in the UK: Legal Framework and Best Practices','Navigate the complex legal landscape of UK data protection laws and ensure your web scraping activities remain fully compliant.','Comprehensive guide to UK web scraping compliance covering GDPR, legal frameworks, and best practices for professional data extraction.','',NULL,1,'UK Data Services Legal Team','Legal and Compliance Specialists','UK Web Scraping Compliance Guide: Legal Framework & Best Practices','Navigate UK web scraping laws with our comprehensive compliance guide. GDPR, legal frameworks, and best practices for professional data extraction.',NULL,12,0,1,1,'2025-06-08 09:00:00','2025-06-08 10:29:10','2025-06-08 10:29:10'),(2,'javascript-heavy-sites-scraping','Advanced Techniques for Scraping JavaScript-Heavy Websites','Master the challenges of extracting data from dynamic websites using modern browser automation and rendering techniques.','Learn advanced techniques for scraping modern JavaScript-heavy websites using browser automation, headless browsers, and dynamic content extraction.','',NULL,1,'UK Data Services Technical Team','Web Scraping Specialists','Scraping JavaScript Websites: Advanced Techniques & Tools','Master JavaScript website scraping with advanced techniques, browser automation, and dynamic content extraction strategies.',NULL,8,0,1,0,'2025-06-01 10:00:00','2025-06-08 10:29:10','2025-06-08 10:29:10'),(3,'competitive-intelligence-roi-metrics','Measuring ROI from Competitive Intelligence Programmes','Learn how to quantify the business value of competitive intelligence initiatives and demonstrate measurable returns.','Comprehensive guide to measuring ROI from competitive intelligence programmes with proven frameworks, metrics, and calculation methods.','',NULL,2,'UK Data Services Analytics Team','Business Intelligence Specialists','Measuring ROI from Competitive Intelligence: UK Business Guide','Learn how to quantify competitive intelligence ROI with proven frameworks, metrics, and calculation methods for UK businesses.',NULL,15,0,1,1,'2025-06-05 09:00:00','2025-06-08 10:29:10','2025-06-08 10:29:10'),(4,'data-automation-strategies-uk-businesses','Data Automation Strategies for UK Businesses: A Complete Implementation Guide','Transform your operations with intelligent automation that reduces costs by up to 40% while improving accuracy and decision-making speed.','Discover proven data automation strategies that UK businesses use to reduce costs by 40% and improve decision-making with complete implementation frameworks.','',NULL,3,'UK Data Services Team','Business Intelligence Specialists','Data Automation Strategies for UK Businesses: Complete Guide','Discover proven data automation strategies that UK businesses use to reduce costs by 40% and improve decision-making. Complete guide with implementation frameworks.',NULL,12,0,1,1,'2025-06-08 09:00:00','2025-06-08 10:29:10','2025-06-08 10:29:10');
/*!40000 ALTER TABLE `blog_articles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `blog_categories`
--

DROP TABLE IF EXISTS `blog_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_categories` (
  `id` int NOT NULL AUTO_INCREMENT,
  `slug` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `meta_title` varchar(160) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_description` varchar(320) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT '1',
  `sort_order` int DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  UNIQUE KEY `unique_slug` (`slug`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_sort_order` (`sort_order`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_categories`
--

LOCK TABLES `blog_categories` WRITE;
/*!40000 ALTER TABLE `blog_categories` DISABLE KEYS */;
INSERT INTO `blog_categories` VALUES (1,'web-scraping','Web Scraping','Expert guides on web scraping techniques, tools, and best practices for professional data extraction.','Web Scraping Articles & Guides | UK Data Services','Expert web scraping tutorials, techniques, and best practices from UK data professionals.',1,1,'2025-06-08 10:29:10','2025-06-08 10:29:10'),(2,'data-analytics','Data Analytics','Business intelligence insights, data analysis methodologies, and advanced analytics techniques.','Data Analytics Articles & Insights | UK Data Services','Expert data analytics guides, business intelligence insights, and data science tutorials from UK professionals.',1,2,'2025-06-08 10:29:10','2025-06-08 10:29:10'),(3,'business-intelligence','Business Intelligence','Strategic business intelligence solutions, automation strategies, and data-driven decision making.','Business Intelligence Insights | UK Data Services','Expert insights on business intelligence, data automation, and strategic data solutions.',1,3,'2025-06-08 10:29:10','2025-06-08 10:29:10');
/*!40000 ALTER TABLE `blog_categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Temporary view structure for view `blog_category_stats`
--

DROP TABLE IF EXISTS `blog_category_stats`;
/*!50001 DROP VIEW IF EXISTS `blog_category_stats`*/;
SET @saved_cs_client     = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `blog_category_stats` AS SELECT 
 1 AS `id`,
 1 AS `slug`,
 1 AS `name`,
 1 AS `total_articles`,
 1 AS `published_articles`,
 1 AS `featured_articles`,
 1 AS `total_views`,
 1 AS `latest_article_date`*/;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `blog_comments`
--

DROP TABLE IF EXISTS `blog_comments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_comments` (
  `id` int NOT NULL AUTO_INCREMENT,
  `article_id` int NOT NULL,
  `author_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `author_website` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `is_approved` tinyint(1) DEFAULT '0',
  `parent_id` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `parent_id` (`parent_id`),
  KEY `idx_article_id` (`article_id`),
  KEY `idx_is_approved` (`is_approved`),
  KEY `idx_created_at` (`created_at`),
  CONSTRAINT `blog_comments_ibfk_1` FOREIGN KEY (`article_id`) REFERENCES `blog_articles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `blog_comments_ibfk_2` FOREIGN KEY (`parent_id`) REFERENCES `blog_comments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_comments`
--

LOCK TABLES `blog_comments` WRITE;
/*!40000 ALTER TABLE `blog_comments` DISABLE KEYS */;
/*!40000 ALTER TABLE `blog_comments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Temporary view structure for view `blog_popular_articles`
--

DROP TABLE IF EXISTS `blog_popular_articles`;
/*!50001 DROP VIEW IF EXISTS `blog_popular_articles`*/;
SET @saved_cs_client     = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `blog_popular_articles` AS SELECT 
 1 AS `id`,
 1 AS `slug`,
 1 AS `title`,
 1 AS `published_at`,
 1 AS `category_name`,
 1 AS `total_views`,
 1 AS `unique_visitors`,
 1 AS `avg_reading_time`,
 1 AS `avg_scroll_percentage`*/;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `blog_subscriptions`
--

DROP TABLE IF EXISTS `blog_subscriptions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_subscriptions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `categories` json DEFAULT NULL,
  `frequency` enum('immediate','daily','weekly','monthly') COLLATE utf8mb4_unicode_ci DEFAULT 'weekly',
  `subscribed_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `last_sent_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','confirmed','unsubscribed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `confirmation_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_email` (`email`),
  KEY `idx_status` (`status`),
  KEY `idx_frequency` (`frequency`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_subscriptions`
--

LOCK TABLES `blog_subscriptions` WRITE;
/*!40000 ALTER TABLE `blog_subscriptions` DISABLE KEYS */;
/*!40000 ALTER TABLE `blog_subscriptions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `blog_tags`
--

DROP TABLE IF EXISTS `blog_tags`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `blog_tags` (
  `id` int NOT NULL AUTO_INCREMENT,
  `slug` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  UNIQUE KEY `unique_slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `blog_tags`
--

LOCK TABLES `blog_tags` WRITE;
/*!40000 ALTER TABLE `blog_tags` DISABLE KEYS */;
INSERT INTO `blog_tags` VALUES (1,'uk-compliance','UK Compliance','UK-specific legal and regulatory compliance topics','2025-06-08 10:29:10'),(2,'gdpr','GDPR','General Data Protection Regulation compliance and best practices','2025-06-08 10:29:10'),(3,'automation','Automation','Data automation strategies and implementation','2025-06-08 10:29:10'),(4,'roi-measurement','ROI Measurement','Return on investment calculation and measurement techniques','2025-06-08 10:29:10'),(5,'web-scraping-tools','Web Scraping Tools','Tools and technologies for web scraping','2025-06-08 10:29:10'),(6,'javascript','JavaScript','JavaScript-related web scraping and development topics','2025-06-08 10:29:10'),(7,'python','Python','Python programming for data extraction and analysis','2025-06-08 10:29:10'),(8,'competitive-intelligence','Competitive Intelligence','Competitive analysis and market intelligence','2025-06-08 10:29:10'),(9,'data-quality','Data Quality','Data validation, cleaning, and quality assurance','2025-06-08 10:29:10'),(10,'uk-business','UK Business','UK-specific business topics and strategies','2025-06-08 10:29:10');
/*!40000 ALTER TABLE `blog_tags` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `contact_submissions`
--

DROP TABLE IF EXISTS `contact_submissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `contact_submissions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `company` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `service` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `source_article_id` int DEFAULT NULL,
  `source_page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `submitted_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `status` enum('new','contacted','converted','closed') COLLATE utf8mb4_unicode_ci DEFAULT 'new',
  `notes` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `idx_email` (`email`),
  KEY `idx_submitted_at` (`submitted_at`),
  KEY `idx_status` (`status`),
  KEY `idx_contact_source_article` (`source_article_id`),
  KEY `idx_contact_source_page` (`source_page`),
  CONSTRAINT `contact_submissions_ibfk_1` FOREIGN KEY (`source_article_id`) REFERENCES `blog_articles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `contact_submissions`
--

LOCK TABLES `contact_submissions` WRITE;
/*!40000 ALTER TABLE `contact_submissions` DISABLE KEYS */;
INSERT INTO `contact_submissions` VALUES (1,'Test User','test@example.com','Test Company','data-cleaning',NULL,NULL,'This is a test submission',NULL,NULL,'2025-06-08 10:29:10','new',NULL);
/*!40000 ALTER TABLE `contact_submissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Temporary view structure for view `daily_contact_stats`
--

DROP TABLE IF EXISTS `daily_contact_stats`;
/*!50001 DROP VIEW IF EXISTS `daily_contact_stats`*/;
SET @saved_cs_client     = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `daily_contact_stats` AS SELECT 
 1 AS `date`,
 1 AS `total_submissions`,
 1 AS `unique_contacts`,
 1 AS `conversions`*/;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `error_logs`
--

DROP TABLE IF EXISTS `error_logs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `error_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `error_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `error_message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `file_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `line_number` int DEFAULT NULL,
  `stack_trace` text COLLATE utf8mb4_unicode_ci,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `occurred_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_error_type` (`error_type`),
  KEY `idx_occurred_at` (`occurred_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `error_logs`
--

LOCK TABLES `error_logs` WRITE;
/*!40000 ALTER TABLE `error_logs` DISABLE KEYS */;
/*!40000 ALTER TABLE `error_logs` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `faq_searches`
--

DROP TABLE IF EXISTS `faq_searches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `faq_searches` (
  `id` int NOT NULL AUTO_INCREMENT,
  `search_term` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `results_found` int DEFAULT '0',
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `searched_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_search_term` (`search_term`),
  KEY `idx_searched_at` (`searched_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `faq_searches`
--

LOCK TABLES `faq_searches` WRITE;
/*!40000 ALTER TABLE `faq_searches` DISABLE KEYS */;
/*!40000 ALTER TABLE `faq_searches` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `newsletter_subscriptions`
--

DROP TABLE IF EXISTS `newsletter_subscriptions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `newsletter_subscriptions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `interests` json DEFAULT NULL,
  `subscribed_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `unsubscribed_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','confirmed','unsubscribed') COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
  `confirmation_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `unique_email` (`email`),
  KEY `idx_status` (`status`),
  KEY `idx_subscribed_at` (`subscribed_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `newsletter_subscriptions`
--

LOCK TABLES `newsletter_subscriptions` WRITE;
/*!40000 ALTER TABLE `newsletter_subscriptions` DISABLE KEYS */;
/*!40000 ALTER TABLE `newsletter_subscriptions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Temporary view structure for view `popular_services`
--

DROP TABLE IF EXISTS `popular_services`;
/*!50001 DROP VIEW IF EXISTS `popular_services`*/;
SET @saved_cs_client     = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `popular_services` AS SELECT 
 1 AS `service`,
 1 AS `request_count`,
 1 AS `unique_requesters`*/;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `quote_requests`
--

DROP TABLE IF EXISTS `quote_requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `quote_requests` (
  `id` int NOT NULL AUTO_INCREMENT,
  `company_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `first_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_size` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `services_needed` json DEFAULT NULL,
  `project_details` text COLLATE utf8mb4_unicode_ci,
  `budget` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `timeline` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `source_article_id` int DEFAULT NULL,
  `source_page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `submitted_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `status` enum('new','reviewing','quoted','accepted','declined') COLLATE utf8mb4_unicode_ci DEFAULT 'new',
  `quote_amount` decimal(10,2) DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `idx_email` (`email`),
  KEY `idx_submitted_at` (`submitted_at`),
  KEY `idx_status` (`status`),
  KEY `idx_quote_source_article` (`source_article_id`),
  KEY `idx_quote_source_page` (`source_page`),
  CONSTRAINT `quote_requests_ibfk_1` FOREIGN KEY (`source_article_id`) REFERENCES `blog_articles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `quote_requests`
--

LOCK TABLES `quote_requests` WRITE;
/*!40000 ALTER TABLE `quote_requests` DISABLE KEYS */;
/*!40000 ALTER TABLE `quote_requests` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `site_analytics`
--

DROP TABLE IF EXISTS `site_analytics`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `site_analytics` (
  `id` int NOT NULL AUTO_INCREMENT,
  `page_url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `referrer` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `session_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `visit_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `page_load_time` int DEFAULT NULL,
  `country` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `city` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_page_url` (`page_url`),
  KEY `idx_visit_time` (`visit_time`),
  KEY `idx_session_id` (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `site_analytics`
--

LOCK TABLES `site_analytics` WRITE;
/*!40000 ALTER TABLE `site_analytics` DISABLE KEYS */;
/*!40000 ALTER TABLE `site_analytics` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sw_cache_log`
--

DROP TABLE IF EXISTS `sw_cache_log`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sw_cache_log` (
  `id` int NOT NULL AUTO_INCREMENT,
  `event_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `resource_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cache_status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `response_time` int DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `idx_event_type` (`event_type`),
  KEY `idx_timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sw_cache_log`
--

LOCK TABLES `sw_cache_log` WRITE;
/*!40000 ALTER TABLE `sw_cache_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `sw_cache_log` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user_sessions`
--

DROP TABLE IF EXISTS `user_sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_sessions` (
  `session_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `started_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `last_activity` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `pages_viewed` int DEFAULT '1',
  `referrer` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_bot` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`session_id`),
  KEY `idx_started_at` (`started_at`),
  KEY `idx_last_activity` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `user_sessions`
--

LOCK TABLES `user_sessions` WRITE;
/*!40000 ALTER TABLE `user_sessions` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Final view structure for view `blog_category_stats`
--

/*!50001 DROP VIEW IF EXISTS `blog_category_stats`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8mb4 */;
/*!50001 SET character_set_results     = utf8mb4 */;
/*!50001 SET collation_connection      = utf8mb4_0900_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `blog_category_stats` AS select `c`.`id` AS `id`,`c`.`slug` AS `slug`,`c`.`name` AS `name`,count(`a`.`id`) AS `total_articles`,count((case when (`a`.`is_published` = true) then 1 end)) AS `published_articles`,count((case when (`a`.`is_featured` = true) then 1 end)) AS `featured_articles`,count(`ba`.`id`) AS `total_views`,max(`a`.`published_at`) AS `latest_article_date` from ((`blog_categories` `c` left join `blog_articles` `a` on((`c`.`id` = `a`.`category_id`))) left join `blog_analytics` `ba` on((`c`.`id` = `ba`.`category_id`))) group by `c`.`id`,`c`.`slug`,`c`.`name` order by `c`.`sort_order` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `blog_popular_articles`
--

/*!50001 DROP VIEW IF EXISTS `blog_popular_articles`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8mb4 */;
/*!50001 SET character_set_results     = utf8mb4 */;
/*!50001 SET collation_connection      = utf8mb4_0900_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `blog_popular_articles` AS select `a`.`id` AS `id`,`a`.`slug` AS `slug`,`a`.`title` AS `title`,`a`.`published_at` AS `published_at`,`c`.`name` AS `category_name`,count(`ba`.`id`) AS `total_views`,count(distinct `ba`.`session_id`) AS `unique_visitors`,avg(`ba`.`reading_time_seconds`) AS `avg_reading_time`,avg(`ba`.`scroll_percentage`) AS `avg_scroll_percentage` from ((`blog_articles` `a` left join `blog_categories` `c` on((`a`.`category_id` = `c`.`id`))) left join `blog_analytics` `ba` on((`a`.`id` = `ba`.`article_id`))) where (`a`.`is_published` = true) group by `a`.`id`,`a`.`slug`,`a`.`title`,`a`.`published_at`,`c`.`name` order by `total_views` desc */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `daily_contact_stats`
--

/*!50001 DROP VIEW IF EXISTS `daily_contact_stats`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8mb4 */;
/*!50001 SET character_set_results     = utf8mb4 */;
/*!50001 SET collation_connection      = utf8mb4_0900_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `daily_contact_stats` AS select cast(`contact_submissions`.`submitted_at` as date) AS `date`,count(0) AS `total_submissions`,count(distinct `contact_submissions`.`email`) AS `unique_contacts`,sum((case when (`contact_submissions`.`status` = 'converted') then 1 else 0 end)) AS `conversions` from `contact_submissions` where (`contact_submissions`.`submitted_at` >= (curdate() - interval 30 day)) group by cast(`contact_submissions`.`submitted_at` as date) order by `date` desc */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `popular_services`
--

/*!50001 DROP VIEW IF EXISTS `popular_services`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8mb4 */;
/*!50001 SET character_set_results     = utf8mb4 */;
/*!50001 SET collation_connection      = utf8mb4_0900_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `popular_services` AS select `contact_submissions`.`service` AS `service`,count(0) AS `request_count`,count(distinct `contact_submissions`.`email`) AS `unique_requesters` from `contact_submissions` where ((`contact_submissions`.`service` is not null) and (`contact_submissions`.`submitted_at` >= (curdate() - interval 90 day))) group by `contact_submissions`.`service` order by `request_count` desc */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2025-06-08 10:41:09
