Update: 2026-07-04 20:53:30

This commit is contained in:
Hamza-Ayed
2026-07-04 20:53:30 +03:00
parent 3c06b3624b
commit df4af1ac2b
15 changed files with 493 additions and 64 deletions
+70
View File
@@ -2070,3 +2070,73 @@ CREATE TABLE `driver_streaks` (
UNIQUE KEY `driver_id` (`driver_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ==========================================================
-- Marketing Engine & Social Media Bot Combined Schema
-- ==========================================================
-- 1. Original Social Media Tables (Facebook, Instagram)
CREATE TABLE IF NOT EXISTS `social_accounts` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`platform` ENUM('facebook', 'instagram', 'tiktok', 'twitter', 'youtube') NOT NULL,
`username` VARCHAR(100) NOT NULL,
`status` ENUM('active', 'restricted', 'banned') DEFAULT 'active',
`total_posts` INT DEFAULT 0,
`total_comments` INT DEFAULT 0,
`total_videos` INT DEFAULT 0,
`last_active` DATETIME NULL,
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS `social_tasks` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`account_id` INT NULL,
`platform` ENUM('facebook', 'instagram', 'tiktok', 'twitter', 'youtube') NOT NULL,
`type` ENUM('join_group', 'read_posts', 'post_comment', 'share_link', 'upload_video', 'post_tweet') NOT NULL,
`target_url` VARCHAR(500) NULL, -- URL of the group, post, or media download
`prompt_context` TEXT NULL,
`generated_comment` TEXT NULL,
`status` ENUM('pending', 'in_progress', 'completed', 'failed') DEFAULT 'pending',
`error_message` TEXT NULL,
`scheduled_at` DATETIME NULL,
`completed_at` DATETIME NULL,
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`account_id`) REFERENCES `social_accounts`(`id`) ON DELETE SET NULL
);
CREATE TABLE IF NOT EXISTS `social_logs` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`task_id` INT NULL,
`account_id` INT NULL,
`log_level` ENUM('info', 'warning', 'error') DEFAULT 'info',
`message` TEXT NOT NULL,
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`task_id`) REFERENCES `social_tasks`(`id`) ON DELETE SET NULL,
FOREIGN KEY (`account_id`) REFERENCES `social_accounts`(`id`) ON DELETE SET NULL
);
-- 2. New Content Generation Pipeline Tables
CREATE TABLE IF NOT EXISTS `content_pipeline` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`topic` VARCHAR(255) NOT NULL,
`script_text` TEXT NULL,
`voice_url` VARCHAR(500) NULL,
`video_url` VARCHAR(500) NULL,
`status` ENUM('pending', 'script_generated', 'voice_generated', 'video_rendered', 'published', 'failed') DEFAULT 'pending',
`error_message` TEXT NULL,
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS `api_quotas` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`service_name` ENUM('gemini', 'elevenlabs', 'creatomate', 'heygen') NOT NULL,
`daily_usage` INT DEFAULT 0,
`quota_limit` INT DEFAULT 10,
`last_reset` DATE NOT NULL
);
INSERT IGNORE INTO `api_quotas` (`service_name`, `daily_usage`, `quota_limit`, `last_reset`) VALUES
('gemini', 0, 100, CURDATE()),
('elevenlabs', 0, 5, CURDATE()),
('creatomate', 0, 2, CURDATE());