-- MySQL dump 10.13  Distrib 9.4.0, for macos15.4 (arm64)
--
-- Host: localhost    Database: profads_v2
-- ------------------------------------------------------
-- Server version	8.0.30

/*!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 `brands`
--

DROP TABLE IF EXISTS `brands`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `brands` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `industry` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `website` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_email` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_phone` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `billing_address` text COLLATE utf8mb4_unicode_ci,
  `gst_number` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) DEFAULT NULL,
  `created_at` datetime DEFAULT (now()),
  `updated_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `brands`
--

LOCK TABLES `brands` WRITE;
/*!40000 ALTER TABLE `brands` DISABLE KEYS */;
INSERT INTO `brands` VALUES (1,'Pranav Test','Tech','https://www.chlsoftech.com','Pranav Menon','P@g.com','86038992002','TEst Billing Address',NULL,'Test Notes',1,'2025-11-21 22:24:38','2025-11-21 22:24:38'),(2,'Pranav TEst 2','Tech IT',NULL,'Pranav','p@indiaisus.com',NULL,NULL,NULL,NULL,1,'2025-11-21 23:35:38','2025-11-21 23:35:38'),(3,'Pranav Brand 3','Fintech','https://www.indiaisus.com','Pranav 3','p@i2u.com','8606800200','Test Billing Address',NULL,'Notes',1,'2025-11-22 09:19:27','2025-11-22 09:19:27');
/*!40000 ALTER TABLE `brands` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `campaign_creators`
--

DROP TABLE IF EXISTS `campaign_creators`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `campaign_creators` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `creator_id` int NOT NULL,
  `status` enum('RECOMMENDED','SHORTLISTED','APPROVED','REJECTED') COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `creator_id` (`creator_id`),
  CONSTRAINT `campaign_creators_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `campaign_creators_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `campaign_creators`
--

LOCK TABLES `campaign_creators` WRITE;
/*!40000 ALTER TABLE `campaign_creators` DISABLE KEYS */;
INSERT INTO `campaign_creators` VALUES (1,1,3,'SHORTLISTED'),(2,1,2,'SHORTLISTED'),(3,2,4,'SHORTLISTED'),(4,2,1,'SHORTLISTED');
/*!40000 ALTER TABLE `campaign_creators` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `campaign_deliverables`
--

DROP TABLE IF EXISTS `campaign_deliverables`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `campaign_deliverables` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `platform_id` int NOT NULL,
  `deliverable_type_id` int NOT NULL,
  `quantity` int NOT NULL,
  `notes` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `platform_id` (`platform_id`),
  KEY `deliverable_type_id` (`deliverable_type_id`),
  CONSTRAINT `campaign_deliverables_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `campaign_deliverables_ibfk_2` FOREIGN KEY (`platform_id`) REFERENCES `platforms` (`id`),
  CONSTRAINT `campaign_deliverables_ibfk_3` FOREIGN KEY (`deliverable_type_id`) REFERENCES `deliverable_types` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `campaign_deliverables`
--

LOCK TABLES `campaign_deliverables` WRITE;
/*!40000 ALTER TABLE `campaign_deliverables` DISABLE KEYS */;
INSERT INTO `campaign_deliverables` VALUES (1,1,1,4,1,NULL),(2,1,2,1,2,NULL),(3,2,1,4,1,NULL),(4,2,2,1,1,NULL);
/*!40000 ALTER TABLE `campaign_deliverables` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `campaign_platforms`
--

DROP TABLE IF EXISTS `campaign_platforms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `campaign_platforms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `platform_id` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `platform_id` (`platform_id`),
  CONSTRAINT `campaign_platforms_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `campaign_platforms_ibfk_2` FOREIGN KEY (`platform_id`) REFERENCES `platforms` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `campaign_platforms`
--

LOCK TABLES `campaign_platforms` WRITE;
/*!40000 ALTER TABLE `campaign_platforms` DISABLE KEYS */;
INSERT INTO `campaign_platforms` VALUES (1,1,1),(2,1,2),(3,2,1),(4,2,2);
/*!40000 ALTER TABLE `campaign_platforms` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `campaigns`
--

DROP TABLE IF EXISTS `campaigns`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `campaigns` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nature` enum('Product Promotion','Online Callouts','Location Visit','Event Visit') COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `brand_id` int DEFAULT NULL,
  `preferred_location` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `preferred_language` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `creator_genre` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `creator_segment` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `creator_category` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `min_followers` int DEFAULT NULL,
  `max_followers` int DEFAULT NULL,
  `total_budget` decimal(12,2) DEFAULT NULL,
  `margin_percentage` decimal(5,2) DEFAULT NULL,
  `created_by` int NOT NULL,
  `created_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  KEY `brand_id` (`brand_id`),
  KEY `created_by` (`created_by`),
  CONSTRAINT `campaigns_ibfk_1` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`),
  CONSTRAINT `campaigns_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `campaigns`
--

LOCK TABLES `campaigns` WRITE;
/*!40000 ALTER TABLE `campaigns` DISABLE KEYS */;
INSERT INTO `campaigns` VALUES (1,'Test Campaign','Product Promotion','GO_LIVE',1,'Delhi','English','Lifestyle','Macro','Femail',20,200,40000.00,NULL,1,'2025-11-21 22:25:44'),(2,'Test Campaign','Product Promotion','SHORTLIST',3,'Delhi','English','Lifestyle','Macro','Femail',20,200,20000.00,NULL,1,'2025-11-22 09:46:32');
/*!40000 ALTER TABLE `campaigns` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `creator_deliverable_contents`
--

DROP TABLE IF EXISTS `creator_deliverable_contents`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_deliverable_contents` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `creator_id` int NOT NULL,
  `campaign_deliverable_id` int NOT NULL,
  `unit_index` int NOT NULL,
  `caption_text` text COLLATE utf8mb4_unicode_ci,
  `content_file` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('DRAFT','UNDER_REVIEW','CHANGES_REQUESTED','APPROVED') COLLATE utf8mb4_unicode_ci NOT NULL,
  `go_live_date` date DEFAULT NULL,
  `go_live_duration_days` int DEFAULT NULL,
  `internal_comment` text COLLATE utf8mb4_unicode_ci,
  `brand_comment` text COLLATE utf8mb4_unicode_ci,
  `updated_at` datetime DEFAULT (now()),
  `live_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `creator_id` (`creator_id`),
  KEY `campaign_deliverable_id` (`campaign_deliverable_id`),
  CONSTRAINT `creator_deliverable_contents_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `creator_deliverable_contents_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`),
  CONSTRAINT `creator_deliverable_contents_ibfk_3` FOREIGN KEY (`campaign_deliverable_id`) REFERENCES `campaign_deliverables` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_deliverable_contents`
--

LOCK TABLES `creator_deliverable_contents` WRITE;
/*!40000 ALTER TABLE `creator_deliverable_contents` DISABLE KEYS */;
INSERT INTO `creator_deliverable_contents` VALUES (1,1,3,1,1,'test',NULL,'APPROVED','2025-11-21',2,NULL,NULL,'2025-11-21 22:29:47',NULL),(2,1,3,2,1,'test',NULL,'APPROVED','2025-11-21',2,NULL,NULL,'2025-11-21 22:29:47',NULL),(3,1,3,2,2,NULL,'content/cont_camp1_cr3_d2_u2.png','APPROVED','2025-11-21',2,NULL,NULL,'2025-11-21 22:29:47',NULL),(4,1,2,1,1,'test',NULL,'APPROVED','2025-11-21',2,NULL,NULL,'2025-11-22 01:46:58','https://www.instagram.com/p/DPiypcGDz_W/?img_index=5&igsh=dHdyZWx1M2N0b2Zj'),(5,1,2,2,1,'test',NULL,'APPROVED','2025-11-21',2,NULL,NULL,'2025-11-22 01:46:58','https://None'),(6,1,2,2,2,'test',NULL,'APPROVED','2025-11-21',2,NULL,NULL,'2025-11-22 01:46:58','https://None');
/*!40000 ALTER TABLE `creator_deliverable_contents` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `creator_deliverable_performance`
--

DROP TABLE IF EXISTS `creator_deliverable_performance`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_deliverable_performance` (
  `id` int NOT NULL AUTO_INCREMENT,
  `content_id` int NOT NULL,
  `impressions` int DEFAULT NULL,
  `reach` int DEFAULT NULL,
  `likes` int DEFAULT NULL,
  `comments` int DEFAULT NULL,
  `shares` int DEFAULT NULL,
  `saves` int DEFAULT NULL,
  `clicks` int DEFAULT NULL,
  `conversions` int DEFAULT NULL,
  `engagement_rate` float DEFAULT NULL,
  `ctr` float DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `updated_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  UNIQUE KEY `content_id` (`content_id`),
  CONSTRAINT `creator_deliverable_performance_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `creator_deliverable_contents` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_deliverable_performance`
--

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

--
-- Table structure for table `creator_deliverable_quotes`
--

DROP TABLE IF EXISTS `creator_deliverable_quotes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_deliverable_quotes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `creator_id` int NOT NULL,
  `campaign_deliverable_id` int NOT NULL,
  `unit_index` int NOT NULL,
  `creator_cost` decimal(12,2) NOT NULL,
  `margin_type` enum('VALUE','PERCENT') COLLATE utf8mb4_unicode_ci NOT NULL,
  `margin_value` decimal(12,2) NOT NULL,
  `margin_amount` decimal(12,2) NOT NULL,
  `total_cost` decimal(12,2) NOT NULL,
  `is_approved_by_brand` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `creator_id` (`creator_id`),
  KEY `campaign_deliverable_id` (`campaign_deliverable_id`),
  CONSTRAINT `creator_deliverable_quotes_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `creator_deliverable_quotes_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`),
  CONSTRAINT `creator_deliverable_quotes_ibfk_3` FOREIGN KEY (`campaign_deliverable_id`) REFERENCES `campaign_deliverables` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_deliverable_quotes`
--

LOCK TABLES `creator_deliverable_quotes` WRITE;
/*!40000 ALTER TABLE `creator_deliverable_quotes` DISABLE KEYS */;
INSERT INTO `creator_deliverable_quotes` VALUES (1,1,3,1,1,2000.00,'VALUE',500.00,500.00,2500.00,0),(2,1,3,2,1,2000.00,'PERCENT',30.00,600.00,2600.00,0),(3,1,3,2,2,2000.00,'VALUE',500.00,500.00,2500.00,0),(4,1,2,1,1,3400.00,'PERCENT',50.00,1700.00,5100.00,0),(5,1,2,2,1,3400.00,'PERCENT',30.00,1020.00,4420.00,0),(6,1,2,2,2,400.00,'PERCENT',50.00,200.00,600.00,0),(7,2,4,3,1,200.00,'PERCENT',50.00,100.00,300.00,0);
/*!40000 ALTER TABLE `creator_deliverable_quotes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `creator_deliverable_scripts`
--

DROP TABLE IF EXISTS `creator_deliverable_scripts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_deliverable_scripts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `creator_id` int NOT NULL,
  `campaign_deliverable_id` int NOT NULL,
  `unit_index` int NOT NULL,
  `script_text` text COLLATE utf8mb4_unicode_ci,
  `script_file` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('DRAFT','UNDER_REVIEW','CHANGES_REQUESTED','APPROVED') COLLATE utf8mb4_unicode_ci NOT NULL,
  `internal_comment` text COLLATE utf8mb4_unicode_ci,
  `brand_comment` text COLLATE utf8mb4_unicode_ci,
  `updated_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `creator_id` (`creator_id`),
  KEY `campaign_deliverable_id` (`campaign_deliverable_id`),
  CONSTRAINT `creator_deliverable_scripts_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `creator_deliverable_scripts_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`),
  CONSTRAINT `creator_deliverable_scripts_ibfk_3` FOREIGN KEY (`campaign_deliverable_id`) REFERENCES `campaign_deliverables` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_deliverable_scripts`
--

LOCK TABLES `creator_deliverable_scripts` WRITE;
/*!40000 ALTER TABLE `creator_deliverable_scripts` DISABLE KEYS */;
INSERT INTO `creator_deliverable_scripts` VALUES (1,1,3,1,1,'Test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18'),(2,1,3,2,1,'Test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18'),(3,1,3,2,2,'test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18'),(4,1,2,1,1,'test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18'),(5,1,2,2,1,'test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18'),(6,1,2,2,2,'test',NULL,'APPROVED',NULL,NULL,'2025-11-21 22:27:18');
/*!40000 ALTER TABLE `creator_deliverable_scripts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `creator_payout_payments`
--

DROP TABLE IF EXISTS `creator_payout_payments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_payout_payments` (
  `id` int NOT NULL AUTO_INCREMENT,
  `payout_id` int NOT NULL,
  `payment_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `mode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  KEY `payout_id` (`payout_id`),
  CONSTRAINT `creator_payout_payments_ibfk_1` FOREIGN KEY (`payout_id`) REFERENCES `creator_payouts` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_payout_payments`
--

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

--
-- Table structure for table `creator_payouts`
--

DROP TABLE IF EXISTS `creator_payouts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creator_payouts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `campaign_id` int NOT NULL,
  `creator_id` int NOT NULL,
  `total_creator_cost` decimal(12,2) NOT NULL,
  `amount_paid` decimal(12,2) NOT NULL,
  `status` enum('PENDING','PARTIAL','PAID') COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT (now()),
  `updated_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`),
  KEY `campaign_id` (`campaign_id`),
  KEY `creator_id` (`creator_id`),
  CONSTRAINT `creator_payouts_ibfk_1` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`),
  CONSTRAINT `creator_payouts_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creator_payouts`
--

LOCK TABLES `creator_payouts` WRITE;
/*!40000 ALTER TABLE `creator_payouts` DISABLE KEYS */;
INSERT INTO `creator_payouts` VALUES (1,1,3,6000.00,0.00,'PENDING',NULL,'2025-11-22 02:13:17','2025-11-22 02:13:17'),(2,1,2,7200.00,0.00,'PENDING',NULL,'2025-11-22 02:13:17','2025-11-22 02:13:17');
/*!40000 ALTER TABLE `creator_payouts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `creators`
--

DROP TABLE IF EXISTS `creators`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `creators` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `handle` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
  `profile_link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `followers_k` decimal(8,2) DEFAULT NULL,
  `genre` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `location` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `category` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `language` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `rate_card_notes` text COLLATE utf8mb4_unicode_ci,
  `is_active` tinyint(1) DEFAULT NULL,
  `created_at` datetime DEFAULT (now()),
  `updated_at` datetime DEFAULT (now()),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creators`
--

LOCK TABLES `creators` WRITE;
/*!40000 ALTER TABLE `creators` DISABLE KEYS */;
INSERT INTO `creators` VALUES (1,'Lovely Roshini','lovelyroshii','https://www.instagram.com/lovelyroshii/?utm_medium=copy_link',9.00,'Lifestyle','AP','Female','Telugu',NULL,NULL,NULL,1,'2025-11-21 22:12:57','2025-11-21 22:12:57'),(2,'foodaholic__soumi','foodaholic__soumi','https://www.instagram.com/foodaholic__soumi/',38.10,'Culinary/Chef/Recipe/Food','KL','Female','English/Malayalam',NULL,NULL,NULL,1,'2025-11-21 22:12:57','2025-11-21 22:12:57'),(3,'rafeel_pvc','rafeel_pvc','https://www.instagram.com/rafeel_pvc/',87.30,'Lifestyle, Fashion/Model','KL','Male','Malayalam',NULL,NULL,NULL,1,'2025-11-21 22:12:57','2025-11-21 22:12:57'),(4,'Creator 1','Pranav3',NULL,200.00,'Lifestyle','Delhi','Female','English','c@creator.com',NULL,NULL,1,'2025-11-22 09:20:33','2025-11-22 09:20:33');
/*!40000 ALTER TABLE `creators` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `deliverable_types`
--

DROP TABLE IF EXISTS `deliverable_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `deliverable_types` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_label` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `deliverable_types`
--

LOCK TABLES `deliverable_types` WRITE;
/*!40000 ALTER TABLE `deliverable_types` DISABLE KEYS */;
INSERT INTO `deliverable_types` VALUES (1,'Reel','videos'),(2,'Story Frame','frames'),(3,'Static Post','posts'),(4,'Long Video','videos'),(5,'Short Video','videos');
/*!40000 ALTER TABLE `deliverable_types` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `invoice_lines`
--

DROP TABLE IF EXISTS `invoice_lines`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoice_lines` (
  `id` int NOT NULL AUTO_INCREMENT,
  `invoice_id` int NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` int NOT NULL,
  `unit_price` decimal(12,2) NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `creator_id` int DEFAULT NULL,
  `campaign_deliverable_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_id` (`invoice_id`),
  KEY `creator_id` (`creator_id`),
  KEY `campaign_deliverable_id` (`campaign_deliverable_id`),
  CONSTRAINT `invoice_lines_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
  CONSTRAINT `invoice_lines_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`),
  CONSTRAINT `invoice_lines_ibfk_3` FOREIGN KEY (`campaign_deliverable_id`) REFERENCES `campaign_deliverables` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `invoice_lines`
--

LOCK TABLES `invoice_lines` WRITE;
/*!40000 ALTER TABLE `invoice_lines` DISABLE KEYS */;
INSERT INTO `invoice_lines` VALUES (1,2,'foodaholic__soumi - Facebook Long Video (Unit 1)',1,5100.00,5100.00,2,1),(2,2,'foodaholic__soumi - Instagram Reel (Unit 1)',1,4420.00,4420.00,2,2),(3,2,'foodaholic__soumi - Instagram Reel (Unit 2)',1,600.00,600.00,2,2),(4,2,'rafeel_pvc - Facebook Long Video (Unit 1)',1,2500.00,2500.00,3,1),(5,2,'rafeel_pvc - Instagram Reel (Unit 1)',1,2600.00,2600.00,3,2),(6,2,'rafeel_pvc - Instagram Reel (Unit 2)',1,2500.00,2500.00,3,2),(7,3,'foodaholic__soumi - Facebook Long Video (Unit 1)',1,5100.00,5100.00,2,1),(8,3,'foodaholic__soumi - Instagram Reel (Unit 1)',1,4420.00,4420.00,2,2),(9,3,'foodaholic__soumi - Instagram Reel (Unit 2)',1,600.00,600.00,2,2),(10,3,'rafeel_pvc - Facebook Long Video (Unit 1)',1,2500.00,2500.00,3,1),(11,3,'rafeel_pvc - Instagram Reel (Unit 1)',1,2600.00,2600.00,3,2),(12,3,'rafeel_pvc - Instagram Reel (Unit 2)',1,2500.00,2500.00,3,2);
/*!40000 ALTER TABLE `invoice_lines` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `invoice_payments`
--

DROP TABLE IF EXISTS `invoice_payments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoice_payments` (
  `id` int NOT NULL AUTO_INCREMENT,
  `invoice_id` int NOT NULL,
  `payment_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `mode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reference` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_id` (`invoice_id`),
  CONSTRAINT `invoice_payments_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `invoice_payments`
--

LOCK TABLES `invoice_payments` WRITE;
/*!40000 ALTER TABLE `invoice_payments` DISABLE KEYS */;
INSERT INTO `invoice_payments` VALUES (1,2,'2025-11-21',20000.00,'UPI','23322','test','2025-11-21 18:20:09');
/*!40000 ALTER TABLE `invoice_payments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `invoices`
--

DROP TABLE IF EXISTS `invoices`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoices` (
  `id` int NOT NULL AUTO_INCREMENT,
  `invoice_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `brand_id` int NOT NULL,
  `campaign_id` int DEFAULT NULL,
  `issue_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `subtotal` decimal(12,2) NOT NULL,
  `tax_percent` decimal(5,2) NOT NULL,
  `tax_amount` decimal(12,2) NOT NULL,
  `total_amount` decimal(12,2) NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invoice_number` (`invoice_number`),
  KEY `brand_id` (`brand_id`),
  KEY `campaign_id` (`campaign_id`),
  CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`),
  CONSTRAINT `invoices_ibfk_2` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `invoices`
--

LOCK TABLES `invoices` WRITE;
/*!40000 ALTER TABLE `invoices` DISABLE KEYS */;
INSERT INTO `invoices` VALUES (2,'INV-202511-0001',1,1,'2025-11-21','2025-11-27',17720.00,18.00,3189.60,20909.60,'PARTIAL','TEst Invoice','2025-11-21 18:03:51'),(3,'INV-202511-0003',1,1,'2025-11-22',NULL,17720.00,18.00,3189.60,20909.60,'DRAFT',NULL,'2025-11-22 03:50:57');
/*!40000 ALTER TABLE `invoices` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `permissions`
--

DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `permissions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `code` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `permissions`
--

LOCK TABLES `permissions` WRITE;
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` VALUES (1,'user.view','Can view users'),(2,'user.create','Can create and edit users'),(3,'role.manage','Manage roles & permissions'),(4,'campaign.view','View campaigns'),(5,'campaign.create','Create campaigns'),(6,'campaign.manage','Shortlist / costing / approval / scripting / content / go live'),(7,'creator.manage','Manage creators'),(8,'brand.manage','Manage brands'),(9,'invoice.view','View invoices'),(10,'invoice.manage','Create / manage invoices');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `platforms`
--

DROP TABLE IF EXISTS `platforms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `platforms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `platforms`
--

LOCK TABLES `platforms` WRITE;
/*!40000 ALTER TABLE `platforms` DISABLE KEYS */;
INSERT INTO `platforms` VALUES (1,'Facebook'),(2,'Instagram'),(3,'Snapchat'),(4,'Twitter'),(5,'YouTube');
/*!40000 ALTER TABLE `platforms` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `role_permissions`
--

DROP TABLE IF EXISTS `role_permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_permissions` (
  `role_id` int NOT NULL,
  `permission_id` int NOT NULL,
  PRIMARY KEY (`role_id`,`permission_id`),
  KEY `permission_id` (`permission_id`),
  CONSTRAINT `role_permissions_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  CONSTRAINT `role_permissions_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `role_permissions`
--

LOCK TABLES `role_permissions` WRITE;
/*!40000 ALTER TABLE `role_permissions` DISABLE KEYS */;
INSERT INTO `role_permissions` VALUES (1,1),(1,2),(1,3),(1,4),(2,4),(3,4),(4,4),(1,5),(2,5),(1,6),(2,6),(1,7),(2,7),(1,8),(2,8),(1,9),(2,9),(3,9),(1,10),(2,10);
/*!40000 ALTER TABLE `role_permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `roles`
--

LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'Admin','Full access to the system'),(2,'Internal Team','Internal team member with campaign access'),(3,'Brand User','Brand-side portal user'),(4,'Creator User','Creator-side portal user');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user_roles`
--

DROP TABLE IF EXISTS `user_roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_roles` (
  `user_id` int NOT NULL,
  `role_id` int NOT NULL,
  PRIMARY KEY (`user_id`,`role_id`),
  KEY `role_id` (`role_id`),
  CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `user_roles`
--

LOCK TABLES `user_roles` WRITE;
/*!40000 ALTER TABLE `user_roles` DISABLE KEYS */;
INSERT INTO `user_roles` VALUES (1,1),(2,3),(3,3),(5,3),(4,4);
/*!40000 ALTER TABLE `user_roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password_hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `full_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `brand_id` int DEFAULT NULL,
  `creator_id` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`),
  KEY `brand_id` (`brand_id`),
  KEY `creator_id` (`creator_id`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`),
  CONSTRAINT `users_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `creators` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'admin','admin@example.com','pbkdf2:sha256:1000000$PcG8gyhjHKQhrurN$1f164c7c4b38d13951936f05b61430ee179064219622e7cb8ede9922ed9a3fad','System Admin',1,NULL,NULL),(2,'PranavBrand','P@gmail.com','pbkdf2:sha256:1000000$5eDzvXpXL7z4NCeG$a33f031711059827f28eecc076b7a4aeec3888b72f4faecc85bfc2d734fcee12','Pranav Menon',1,1,NULL),(3,'PranavBrand2','p@indiaisus.com','pbkdf2:sha256:1000000$QeSgLetvGHhIwhHz$ef5edbddcbd592c2a319f9aacd2496ffac3a6d78f331fd8fe277834add6cf41f','Pranav Test 2',1,2,NULL),(4,'PranavCreator','pranav@creator.com','pbkdf2:sha256:1000000$s476sZE9fEp6pKqy$2cacfa7371879e29e44c636dc56ec404e51fdec60440111b39891d9e85e78ff4','Pranav Creator',1,NULL,2),(5,'PranavBrand3','p@i2u.com','pbkdf2:sha256:1000000$ZE8au9mFPU3Bcx98$2892422a831682c36305d0f56eebfceb33baacfbfafbd6dd74b4a9be758a7cd0','Pranav 3',1,NULL,NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!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-11-22  9:49:43
