Files
finetuning-plattform-setup-…/db/01-schema.sql
m17hr1l 8932534623 Initial delta: full developer manual + DB bootstrap
Generated from finetuning-plattform develop @ 70b203c on 2026-05-14.

Contents:
- MANUAL.md       — full developer manual, setup at front (28 sections)
- bootstrap-db.sh — one-command DB initialization
- db/01-schema.sql       — MariaDB schema, no data
- db/02-seed.sql         — reference data (ACL, email templates, API registry)
- db/03-default-users.sql — admin + test user, argon2id hashes

Drop-in package for new developers joining the platform.
2026-05-14 12:44:47 +02:00

640 lines
39 KiB
SQL

/*M!999999\- enable the sandbox mode */
/*!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 */;
/*!40101 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' */;
/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `account` (
`account_id` int(11) NOT NULL AUTO_INCREMENT,
`account_name` varchar(255) DEFAULT NULL,
`account_active` tinyint(1) DEFAULT 1,
`account_email` varchar(255) DEFAULT NULL,
PRIMARY KEY (`account_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `account_to_api_registry` (
`account_id` int(11) NOT NULL,
`api_registry_id` int(11) DEFAULT NULL,
PRIMARY KEY (`account_id`),
KEY `account_to_api_registry_api_registry_api_registry_id_fk` (`api_registry_id`),
CONSTRAINT `account_to_api_registry_account_account_id_fk` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`),
CONSTRAINT `account_to_api_registry_api_registry_api_registry_id_fk` FOREIGN KEY (`api_registry_id`) REFERENCES `api_registry` (`api_registry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `acl` (
`acl_id` int(11) NOT NULL AUTO_INCREMENT,
`acl_role` varchar(255) DEFAULT NULL,
PRIMARY KEY (`acl_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `agent_templates` (
`agent_templates_id` int(11) NOT NULL AUTO_INCREMENT,
`agent_templates_user_id` int(11) NOT NULL,
`agent_templates_template_key` varchar(50) NOT NULL,
`agent_templates_name` varchar(150) NOT NULL,
`agent_templates_description` text DEFAULT NULL,
`agent_templates_system_prompt` text DEFAULT NULL,
`agent_templates_personality` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`agent_templates_personality`)),
`agent_templates_knowledge_cats` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`agent_templates_knowledge_cats`)),
`agent_templates_training_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`agent_templates_training_data`)),
`agent_templates_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`agent_templates_config`)),
`agent_templates_status` enum('draft','active','archived') DEFAULT 'draft',
`agent_templates_created_at` datetime DEFAULT current_timestamp(),
`agent_templates_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`agent_templates_id`),
KEY `fk_agent_templates_user` (`agent_templates_user_id`),
CONSTRAINT `fk_agent_templates_user` FOREIGN KEY (`agent_templates_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `api_keys` (
`api_keys_id` int(11) NOT NULL AUTO_INCREMENT,
`api_keys_user_id` int(11) NOT NULL,
`api_keys_name` varchar(100) NOT NULL,
`api_keys_hash` varchar(255) NOT NULL,
`api_keys_prefix` varchar(20) NOT NULL,
`api_keys_permissions` longtext DEFAULT NULL,
`api_keys_last_used` datetime DEFAULT NULL,
`api_keys_status` enum('active','revoked') DEFAULT 'active',
`api_keys_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`api_keys_id`),
KEY `idx_user_id` (`api_keys_user_id`),
KEY `idx_status` (`api_keys_status`),
CONSTRAINT `fk_api_keys_user` FOREIGN KEY (`api_keys_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `api_registry` (
`api_registry_id` int(11) NOT NULL AUTO_INCREMENT,
`api_name` varchar(255) DEFAULT NULL,
`api_registered` tinyint(4) DEFAULT 0,
PRIMARY KEY (`api_registry_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_messages` (
`chat_messages_id` int(11) NOT NULL AUTO_INCREMENT,
`chat_messages_session_id` int(11) NOT NULL,
`chat_messages_user_id` int(11) NOT NULL,
`chat_messages_role` enum('user','assistant','system') NOT NULL,
`chat_messages_content` mediumtext NOT NULL,
`chat_messages_rating` tinyint(4) DEFAULT NULL COMMENT 'NULL=unrated, 1=thumbs up, -1=thumbs down',
`chat_messages_feedback_note` text DEFAULT NULL,
`chat_messages_total_duration` bigint(20) DEFAULT NULL COMMENT 'Ollama total_duration in ns',
`chat_messages_eval_count` int(11) DEFAULT NULL COMMENT 'Ollama eval_count (output tokens)',
`chat_messages_regenerated` tinyint(1) NOT NULL DEFAULT 0,
`chat_messages_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`chat_messages_id`),
KEY `idx_chat_messages_session` (`chat_messages_session_id`),
KEY `idx_chat_messages_user` (`chat_messages_user_id`),
KEY `idx_chat_messages_rating` (`chat_messages_rating`),
CONSTRAINT `fk_chat_messages_session` FOREIGN KEY (`chat_messages_session_id`) REFERENCES `test_sessions` (`session_id`) ON DELETE CASCADE,
CONSTRAINT `fk_chat_messages_user` FOREIGN KEY (`chat_messages_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `chat_shares` (
`chat_shares_id` int(11) NOT NULL AUTO_INCREMENT,
`chat_shares_session_id` int(11) NOT NULL,
`chat_shares_user_id` int(11) NOT NULL,
`chat_shares_token` varchar(64) NOT NULL,
`chat_shares_expires_at` datetime DEFAULT NULL,
`chat_shares_view_count` int(11) NOT NULL DEFAULT 0,
`chat_shares_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`chat_shares_id`),
UNIQUE KEY `uniq_chat_shares_token` (`chat_shares_token`),
KEY `fk_chat_shares_user` (`chat_shares_user_id`),
KEY `idx_chat_shares_session` (`chat_shares_session_id`),
CONSTRAINT `fk_chat_shares_session` FOREIGN KEY (`chat_shares_session_id`) REFERENCES `test_sessions` (`session_id`) ON DELETE CASCADE,
CONSTRAINT `fk_chat_shares_user` FOREIGN KEY (`chat_shares_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `datasets` (
`datasets_id` int(11) NOT NULL AUTO_INCREMENT,
`datasets_user_id` int(11) NOT NULL,
`datasets_name` varchar(255) NOT NULL,
`datasets_description` text DEFAULT NULL,
`datasets_file_path` varchar(500) DEFAULT NULL,
`datasets_file_format` enum('jsonl','csv','txt','parquet','pdf','docx') DEFAULT 'jsonl',
`datasets_sample_count` int(11) DEFAULT 0,
`datasets_file_size_bytes` bigint(20) DEFAULT 0,
`datasets_status` enum('uploading','processing','ready','error') DEFAULT 'uploading',
`datasets_validation_result` longtext DEFAULT NULL,
`datasets_created_at` datetime DEFAULT current_timestamp(),
`datasets_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`datasets_id`),
KEY `idx_user_id` (`datasets_user_id`),
KEY `idx_status` (`datasets_status`),
CONSTRAINT `fk_datasets_user` FOREIGN KEY (`datasets_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `email_notification_preferences` (
`email_notification_preferences_id` int(11) NOT NULL AUTO_INCREMENT,
`email_notification_preferences_user_id` int(11) NOT NULL,
`email_notification_preferences_type` varchar(50) NOT NULL COMMENT 'e.g. welcome, job-started, job-completed, job-failed, low-credits, security-alert',
`email_notification_preferences_enabled` tinyint(1) DEFAULT 1,
`email_notification_preferences_created_at` datetime DEFAULT current_timestamp(),
`email_notification_preferences_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`email_notification_preferences_id`),
UNIQUE KEY `unique_user_notification_type` (`email_notification_preferences_user_id`,`email_notification_preferences_type`),
CONSTRAINT `fk_email_notif_pref_user` FOREIGN KEY (`email_notification_preferences_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `email_queue` (
`email_queue_id` int(11) NOT NULL AUTO_INCREMENT,
`email_queue_user_id` int(11) DEFAULT NULL,
`email_queue_template_slug` varchar(100) DEFAULT NULL,
`email_queue_to_email` varchar(255) NOT NULL,
`email_queue_to_name` varchar(255) DEFAULT NULL,
`email_queue_subject` varchar(255) NOT NULL,
`email_queue_body_html` text NOT NULL,
`email_queue_body_text` text DEFAULT NULL,
`email_queue_status` enum('pending','sending','sent','failed') DEFAULT 'pending',
`email_queue_priority` tinyint(4) DEFAULT 5 COMMENT '1=highest, 10=lowest',
`email_queue_attempts` int(11) DEFAULT 0,
`email_queue_max_attempts` int(11) DEFAULT 3,
`email_queue_last_error` text DEFAULT NULL,
`email_queue_scheduled_at` datetime DEFAULT NULL COMMENT 'NULL = send immediately',
`email_queue_sent_at` datetime DEFAULT NULL,
`email_queue_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`email_queue_id`),
KEY `fk_email_queue_user` (`email_queue_user_id`),
KEY `idx_email_queue_status` (`email_queue_status`),
KEY `idx_email_queue_scheduled` (`email_queue_scheduled_at`),
KEY `idx_email_queue_priority` (`email_queue_priority`),
CONSTRAINT `fk_email_queue_user` FOREIGN KEY (`email_queue_user_id`) REFERENCES `user` (`user_id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `email_templates` (
`email_templates_id` int(11) NOT NULL AUTO_INCREMENT,
`email_templates_name` varchar(100) NOT NULL,
`email_templates_slug` varchar(100) NOT NULL,
`email_templates_subject` varchar(255) NOT NULL,
`email_templates_body_html` text NOT NULL,
`email_templates_body_text` text DEFAULT NULL,
`email_templates_variables` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'JSON array of available template variables' CHECK (json_valid(`email_templates_variables`)),
`email_templates_is_active` tinyint(1) DEFAULT 1,
`email_templates_created_at` datetime DEFAULT current_timestamp(),
`email_templates_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`email_templates_id`),
UNIQUE KEY `unique_template_slug` (`email_templates_slug`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gdpr_access_logs` (
`gdpr_access_logs_id` int(11) NOT NULL AUTO_INCREMENT,
`gdpr_access_logs_user_id` int(11) DEFAULT NULL,
`gdpr_access_logs_action` varchar(100) NOT NULL,
`gdpr_access_logs_resource_type` varchar(100) DEFAULT NULL,
`gdpr_access_logs_resource_id` int(11) DEFAULT NULL,
`gdpr_access_logs_ip_address` varchar(45) DEFAULT NULL,
`gdpr_access_logs_user_agent` text DEFAULT NULL,
`gdpr_access_logs_metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`gdpr_access_logs_metadata`)),
`gdpr_access_logs_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`gdpr_access_logs_id`),
KEY `idx_gdpr_access_user` (`gdpr_access_logs_user_id`),
KEY `idx_gdpr_access_action` (`gdpr_access_logs_action`),
KEY `idx_gdpr_access_created` (`gdpr_access_logs_created_at`),
CONSTRAINT `fk_gdpr_access_logs_user` FOREIGN KEY (`gdpr_access_logs_user_id`) REFERENCES `user` (`user_id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gdpr_consent_records` (
`gdpr_consent_records_id` int(11) NOT NULL AUTO_INCREMENT,
`gdpr_consent_records_user_id` int(11) NOT NULL,
`gdpr_consent_records_type` enum('cookie_essential','cookie_analytics','cookie_marketing','data_processing','marketing_emails','terms_of_service') NOT NULL,
`gdpr_consent_records_granted` tinyint(1) DEFAULT 0,
`gdpr_consent_records_ip_address` varchar(45) DEFAULT NULL,
`gdpr_consent_records_user_agent` text DEFAULT NULL,
`gdpr_consent_records_version` varchar(20) DEFAULT '1.0',
`gdpr_consent_records_created_at` datetime DEFAULT current_timestamp(),
`gdpr_consent_records_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`gdpr_consent_records_id`),
KEY `idx_gdpr_consent_user` (`gdpr_consent_records_user_id`),
KEY `idx_gdpr_consent_type` (`gdpr_consent_records_type`),
KEY `idx_gdpr_consent_user_type` (`gdpr_consent_records_user_id`,`gdpr_consent_records_type`),
CONSTRAINT `fk_gdpr_consent_records_user` FOREIGN KEY (`gdpr_consent_records_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gdpr_data_export_requests` (
`gdpr_data_export_requests_id` int(11) NOT NULL AUTO_INCREMENT,
`gdpr_data_export_requests_user_id` int(11) NOT NULL,
`gdpr_data_export_requests_status` enum('pending','processing','completed','failed','expired') DEFAULT 'pending',
`gdpr_data_export_requests_format` enum('json') DEFAULT 'json',
`gdpr_data_export_requests_file_path` varchar(512) DEFAULT NULL,
`gdpr_data_export_requests_file_size` bigint(20) DEFAULT NULL,
`gdpr_data_export_requests_expires_at` datetime DEFAULT NULL,
`gdpr_data_export_requests_completed_at` datetime DEFAULT NULL,
`gdpr_data_export_requests_created_at` datetime DEFAULT current_timestamp(),
`gdpr_data_export_requests_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`gdpr_data_export_requests_id`),
KEY `idx_gdpr_export_user` (`gdpr_data_export_requests_user_id`),
KEY `idx_gdpr_export_status` (`gdpr_data_export_requests_status`),
CONSTRAINT `fk_gdpr_data_export_requests_user` FOREIGN KEY (`gdpr_data_export_requests_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `gdpr_deletion_requests` (
`gdpr_deletion_requests_id` int(11) NOT NULL AUTO_INCREMENT,
`gdpr_deletion_requests_user_id` int(11) NOT NULL,
`gdpr_deletion_requests_status` enum('pending','grace_period','processing','completed','cancelled') DEFAULT 'pending',
`gdpr_deletion_requests_reason` text DEFAULT NULL,
`gdpr_deletion_requests_grace_until` datetime NOT NULL,
`gdpr_deletion_requests_completed_at` datetime DEFAULT NULL,
`gdpr_deletion_requests_cancelled_at` datetime DEFAULT NULL,
`gdpr_deletion_requests_created_at` datetime DEFAULT current_timestamp(),
`gdpr_deletion_requests_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`gdpr_deletion_requests_id`),
KEY `idx_gdpr_deletion_user` (`gdpr_deletion_requests_user_id`),
KEY `idx_gdpr_deletion_status` (`gdpr_deletion_requests_status`),
KEY `idx_gdpr_deletion_grace` (`gdpr_deletion_requests_grace_until`),
CONSTRAINT `fk_gdpr_deletion_requests_user` FOREIGN KEY (`gdpr_deletion_requests_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `handoff_messages` (
`handoff_messages_id` int(11) NOT NULL AUTO_INCREMENT,
`handoff_messages_handoff_id` int(11) NOT NULL,
`handoff_messages_sender_type` enum('user','agent','human') NOT NULL,
`handoff_messages_sender_id` int(11) DEFAULT NULL,
`handoff_messages_content` text NOT NULL,
`handoff_messages_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`handoff_messages_id`),
KEY `fk_handoff_messages_handoff` (`handoff_messages_handoff_id`),
CONSTRAINT `fk_handoff_messages_handoff` FOREIGN KEY (`handoff_messages_handoff_id`) REFERENCES `handoff_requests` (`handoff_requests_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `handoff_requests` (
`handoff_requests_id` int(11) NOT NULL AUTO_INCREMENT,
`handoff_requests_user_id` int(11) NOT NULL,
`handoff_requests_agent_template_id` int(11) DEFAULT NULL,
`handoff_requests_conversation_id` varchar(100) NOT NULL,
`handoff_requests_reason` enum('user_requested','low_confidence','keyword_detected','failed_attempts','sensitive_topic') NOT NULL,
`handoff_requests_reason_detail` text DEFAULT NULL,
`handoff_requests_conversation_context` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`handoff_requests_conversation_context`)),
`handoff_requests_status` enum('pending','assigned','in_progress','resolved','cancelled') DEFAULT 'pending',
`handoff_requests_priority` enum('low','normal','high','urgent') DEFAULT 'normal',
`handoff_requests_assigned_to` int(11) DEFAULT NULL,
`handoff_requests_resolution_note` text DEFAULT NULL,
`handoff_requests_created_at` datetime DEFAULT current_timestamp(),
`handoff_requests_assigned_at` datetime DEFAULT NULL,
`handoff_requests_resolved_at` datetime DEFAULT NULL,
`handoff_requests_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`handoff_requests_id`),
KEY `fk_handoff_requests_user` (`handoff_requests_user_id`),
KEY `fk_handoff_requests_agent_template` (`handoff_requests_agent_template_id`),
KEY `fk_handoff_requests_assigned_to` (`handoff_requests_assigned_to`),
CONSTRAINT `fk_handoff_requests_agent_template` FOREIGN KEY (`handoff_requests_agent_template_id`) REFERENCES `agent_templates` (`agent_templates_id`) ON DELETE SET NULL,
CONSTRAINT `fk_handoff_requests_assigned_to` FOREIGN KEY (`handoff_requests_assigned_to`) REFERENCES `user` (`user_id`) ON DELETE SET NULL,
CONSTRAINT `fk_handoff_requests_user` FOREIGN KEY (`handoff_requests_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `handoff_triggers` (
`handoff_triggers_id` int(11) NOT NULL AUTO_INCREMENT,
`handoff_triggers_user_id` int(11) NOT NULL,
`handoff_triggers_name` varchar(100) NOT NULL,
`handoff_triggers_type` enum('keyword','confidence_threshold','failed_attempts','sensitive_topic','user_request') NOT NULL,
`handoff_triggers_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`handoff_triggers_config`)),
`handoff_triggers_is_active` tinyint(1) DEFAULT 1,
`handoff_triggers_created_at` datetime DEFAULT current_timestamp(),
`handoff_triggers_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`handoff_triggers_id`),
KEY `fk_handoff_triggers_user` (`handoff_triggers_user_id`),
CONSTRAINT `fk_handoff_triggers_user` FOREIGN KEY (`handoff_triggers_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `jobs` (
`jobs_id` int(11) NOT NULL AUTO_INCREMENT,
`jobs_user_id` int(11) NOT NULL,
`jobs_name` varchar(255) NOT NULL,
`jobs_base_model` varchar(100) NOT NULL,
`jobs_dataset_id` int(11) DEFAULT NULL,
`jobs_status` enum('queued','running','completed','failed','cancelled') DEFAULT 'queued',
`jobs_progress` int(11) DEFAULT 0,
`jobs_epochs` int(11) DEFAULT 3,
`jobs_learning_rate` decimal(10,8) DEFAULT 0.00002000,
`jobs_batch_size` int(11) DEFAULT 4,
`jobs_hyperparameters` longtext DEFAULT NULL,
`jobs_result_model_id` int(11) DEFAULT NULL,
`jobs_error_message` text DEFAULT NULL,
`jobs_started_at` datetime DEFAULT NULL,
`jobs_completed_at` datetime DEFAULT NULL,
`jobs_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`jobs_id`),
KEY `idx_user_id` (`jobs_user_id`),
KEY `idx_status` (`jobs_status`),
KEY `idx_created_at` (`jobs_created_at`),
KEY `fk_jobs_dataset` (`jobs_dataset_id`),
KEY `fk_jobs_result_model` (`jobs_result_model_id`),
CONSTRAINT `fk_jobs_dataset` FOREIGN KEY (`jobs_dataset_id`) REFERENCES `datasets` (`datasets_id`) ON DELETE SET NULL,
CONSTRAINT `fk_jobs_result_model` FOREIGN KEY (`jobs_result_model_id`) REFERENCES `models` (`models_id`) ON DELETE SET NULL,
CONSTRAINT `fk_jobs_user` FOREIGN KEY (`jobs_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `knowledge_base_chunks` (
`knowledge_base_chunks_id` int(11) NOT NULL AUTO_INCREMENT,
`knowledge_base_chunks_document_id` int(11) NOT NULL,
`knowledge_base_chunks_index` int(11) NOT NULL,
`knowledge_base_chunks_content` text NOT NULL,
`knowledge_base_chunks_token_count` int(11) DEFAULT 0,
`knowledge_base_chunks_metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`knowledge_base_chunks_metadata`)),
`knowledge_base_chunks_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`knowledge_base_chunks_id`),
KEY `idx_kb_chunks_document_id` (`knowledge_base_chunks_document_id`),
KEY `idx_kb_chunks_index` (`knowledge_base_chunks_document_id`,`knowledge_base_chunks_index`),
CONSTRAINT `fk_kb_chunks_document` FOREIGN KEY (`knowledge_base_chunks_document_id`) REFERENCES `knowledge_base_documents` (`knowledge_base_documents_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `knowledge_base_documents` (
`knowledge_base_documents_id` int(11) NOT NULL AUTO_INCREMENT,
`knowledge_base_documents_user_id` int(11) NOT NULL,
`knowledge_base_documents_name` varchar(255) NOT NULL,
`knowledge_base_documents_original_name` varchar(500) NOT NULL,
`knowledge_base_documents_file_path` varchar(500) DEFAULT NULL,
`knowledge_base_documents_file_format` enum('pdf','docx','doc','txt','csv','xlsx','md','html') NOT NULL,
`knowledge_base_documents_file_size` bigint(20) DEFAULT 0,
`knowledge_base_documents_status` enum('uploaded','processing','processed','error') DEFAULT 'uploaded',
`knowledge_base_documents_error_message` text DEFAULT NULL,
`knowledge_base_documents_extracted_text` longtext DEFAULT NULL,
`knowledge_base_documents_chunk_count` int(11) DEFAULT 0,
`knowledge_base_documents_metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`knowledge_base_documents_metadata`)),
`knowledge_base_documents_created_at` datetime DEFAULT current_timestamp(),
`knowledge_base_documents_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`knowledge_base_documents_id`),
KEY `idx_kb_documents_user_id` (`knowledge_base_documents_user_id`),
KEY `idx_kb_documents_status` (`knowledge_base_documents_status`),
CONSTRAINT `fk_kb_documents_user` FOREIGN KEY (`knowledge_base_documents_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`version` int(11) NOT NULL,
`filename` varchar(255) NOT NULL,
`migrated` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `model_pulls` (
`pull_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT 0,
`model_name` varchar(255) NOT NULL,
`status` enum('pending','pulling','completed','failed') DEFAULT 'pending',
`progress` int(11) DEFAULT 0,
`total_size` bigint(20) DEFAULT 0,
`downloaded_size` bigint(20) DEFAULT 0,
`error_message` text DEFAULT NULL,
`started_at` timestamp NULL DEFAULT current_timestamp(),
`completed_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`pull_id`),
KEY `idx_user_status` (`user_id`,`status`),
KEY `idx_model_name` (`model_name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `modelfiles` (
`modelfiles_id` int(11) NOT NULL AUTO_INCREMENT,
`modelfiles_user_id` int(11) NOT NULL,
`modelfiles_name` varchar(255) NOT NULL,
`modelfiles_description` text DEFAULT NULL,
`modelfiles_content` longtext NOT NULL,
`modelfiles_base_model` varchar(255) DEFAULT NULL,
`modelfiles_status` enum('draft','active','archived') DEFAULT 'draft',
`modelfiles_is_template` tinyint(1) DEFAULT 0,
`modelfiles_template_category` varchar(100) DEFAULT NULL,
`modelfiles_metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`modelfiles_metadata`)),
`modelfiles_created_at` datetime DEFAULT current_timestamp(),
`modelfiles_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`modelfiles_id`),
KEY `idx_modelfiles_user_id` (`modelfiles_user_id`),
KEY `idx_modelfiles_status` (`modelfiles_status`),
KEY `idx_modelfiles_is_template` (`modelfiles_is_template`),
KEY `idx_modelfiles_base_model` (`modelfiles_base_model`),
CONSTRAINT `fk_modelfiles_user` FOREIGN KEY (`modelfiles_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `models` (
`models_id` int(11) NOT NULL AUTO_INCREMENT,
`models_user_id` int(11) NOT NULL,
`models_job_id` int(11) DEFAULT NULL,
`models_name` varchar(255) NOT NULL,
`models_base_model` varchar(100) NOT NULL,
`models_path` varchar(500) DEFAULT NULL,
`models_modelfile_content` text DEFAULT NULL,
`models_metrics` longtext DEFAULT NULL,
`models_status` enum('training','ready','deployed','archived') DEFAULT 'training',
`models_created_at` datetime DEFAULT current_timestamp(),
`models_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`models_id`),
KEY `idx_user_id` (`models_user_id`),
KEY `idx_status` (`models_status`),
KEY `fk_models_job` (`models_job_id`),
CONSTRAINT `fk_models_job` FOREIGN KEY (`models_job_id`) REFERENCES `jobs` (`jobs_id`) ON DELETE SET NULL,
CONSTRAINT `fk_models_user` FOREIGN KEY (`models_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `test_sessions` (
`session_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`model_id` int(11) NOT NULL,
`model_name` varchar(255) NOT NULL,
`container_name` varchar(255) DEFAULT NULL,
`container_port` int(11) DEFAULT NULL,
`status` varchar(20) NOT NULL DEFAULT 'active',
`timeout_seconds` int(11) NOT NULL DEFAULT 1800,
`memory_limit` varchar(10) NOT NULL DEFAULT '8g',
`cpu_limit` int(11) NOT NULL DEFAULT 4,
`started_at` datetime NOT NULL DEFAULT current_timestamp(),
`expires_at` datetime NOT NULL,
`stopped_at` datetime DEFAULT NULL,
`message_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`session_id`),
KEY `fk_test_sessions_model` (`model_id`),
KEY `idx_test_sessions_user_status` (`user_id`,`status`),
KEY `idx_test_sessions_expires` (`expires_at`),
KEY `idx_test_sessions_status` (`status`),
CONSTRAINT `fk_test_sessions_model` FOREIGN KEY (`model_id`) REFERENCES `models` (`models_id`) ON DELETE CASCADE,
CONSTRAINT `fk_test_sessions_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `timeanddate` (
`timeanddate_id` int(11) NOT NULL AUTO_INCREMENT,
`timeanddate_date` date NOT NULL DEFAULT current_timestamp(),
`timeanddate_time` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`timeanddate_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `timeanddate_to_account` (
`account_id` int(11) DEFAULT NULL,
`timeanddate_id` int(11) DEFAULT NULL,
KEY `account_to_timeanddate_account_account_id_fk` (`account_id`),
KEY `account_to_timeanddate_timeanddate_timeanddate_id_fk` (`timeanddate_id`),
CONSTRAINT `account_to_timeanddate_account_account_id_fk` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`),
CONSTRAINT `account_to_timeanddate_timeanddate_timeanddate_id_fk` FOREIGN KEY (`timeanddate_id`) REFERENCES `timeanddate` (`timeanddate_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `timeanddate_to_user` (
`timeanddate_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
KEY `timeanddate_to_user_timeanddate_timeanddate_id_fk` (`timeanddate_id`),
KEY `timeanddate_to_user_user_user_id_fk` (`user_id`),
CONSTRAINT `timeanddate_to_user_timeanddate_timeanddate_id_fk` FOREIGN KEY (`timeanddate_id`) REFERENCES `timeanddate` (`timeanddate_id`),
CONSTRAINT `timeanddate_to_user_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `usage_logs` (
`usage_logs_id` bigint(20) NOT NULL AUTO_INCREMENT,
`usage_logs_user_id` int(11) NOT NULL,
`usage_logs_resource_type` enum('api_call','training','inference','storage') NOT NULL,
`usage_logs_resource_id` int(11) DEFAULT NULL,
`usage_logs_credits_used` decimal(10,4) DEFAULT 0.0000,
`usage_logs_details` longtext DEFAULT NULL,
`usage_logs_created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`usage_logs_id`),
KEY `idx_user_id` (`usage_logs_user_id`),
KEY `idx_created_at` (`usage_logs_created_at`),
KEY `idx_resource_type` (`usage_logs_resource_type`),
CONSTRAINT `fk_usage_logs_user` FOREIGN KEY (`usage_logs_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_firstname` varchar(255) DEFAULT NULL,
`user_lastname` varchar(255) DEFAULT NULL,
`user_email` varchar(255) DEFAULT NULL,
`user_name` varchar(255) DEFAULT NULL,
`user_pass` varbinary(50) DEFAULT NULL,
`user_password_hash` varchar(255) DEFAULT NULL,
`user_login` varchar(255) DEFAULT NULL,
`user_account_active` tinyint(1) NOT NULL DEFAULT 0,
`user_created` datetime DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_pk` (`user_login`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_billing` (
`user_billing_id` int(11) NOT NULL AUTO_INCREMENT,
`user_billing_user_id` int(11) NOT NULL,
`user_billing_plan_type` enum('free','starter','professional','enterprise') DEFAULT 'free',
`user_billing_credits_balance` decimal(12,4) DEFAULT 0.0000,
`user_billing_credits_used_month` decimal(12,4) DEFAULT 0.0000,
`user_billing_cycle_start` date DEFAULT NULL,
`user_billing_cycle_end` date DEFAULT NULL,
`user_billing_stripe_customer_id` varchar(100) DEFAULT NULL,
`user_billing_paypal_customer_id` varchar(100) DEFAULT NULL,
`user_billing_created_at` datetime DEFAULT current_timestamp(),
`user_billing_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`user_billing_id`),
UNIQUE KEY `user_id` (`user_billing_user_id`),
CONSTRAINT `fk_user_billing_user` FOREIGN KEY (`user_billing_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_settings` (
`user_settings_id` int(11) NOT NULL AUTO_INCREMENT,
`user_settings_user_id` int(11) NOT NULL,
`user_settings_key` varchar(100) NOT NULL,
`user_settings_value` text DEFAULT NULL,
`user_settings_created_at` datetime DEFAULT current_timestamp(),
`user_settings_updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`user_settings_id`),
UNIQUE KEY `unique_user_setting` (`user_settings_user_id`,`user_settings_key`),
CONSTRAINT `fk_user_settings_user` FOREIGN KEY (`user_settings_user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_to_account` (
`account_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
KEY `user_to_account_account_account_id_fk` (`account_id`),
KEY `user_to_account_user_user_id_fk` (`user_id`),
CONSTRAINT `user_to_account_account_account_id_fk` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`),
CONSTRAINT `user_to_account_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_to_acl` (
`user_id` int(11) NOT NULL,
`acl_id` int(11) NOT NULL,
KEY `user_to_acl_user_user_id_fk` (`user_id`),
KEY `user_to_acl_acl_acl_id_fk` (`acl_id`),
CONSTRAINT `user_to_acl_acl_acl_id_fk` FOREIGN KEY (`acl_id`) REFERENCES `acl` (`acl_id`),
CONSTRAINT `user_to_acl_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!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 */;
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;