From f3d6d6b6d3ee9554301eb2b57970a85d00e3803e Mon Sep 17 00:00:00 2001 From: m17hr1l Date: Thu, 14 May 2026 13:15:32 +0200 Subject: [PATCH] Add db/dev-snapshot.sql with Stephan's local working state Full mariadb-dump (schema + data) from the live develop instance, post-NFP-18 migration. Includes test data new devs can immediately poke at instead of staring at an empty dashboard. Contents: - 36 tables (full schema) - 2 users (admin@finetune.ai/admin123, testuser@example.com/test123) - 5 datasets, 1 job (Support Bot v1, completed), 1 model - 1 user_billing row, 5 user_settings rows - 8 email_templates, 3 ACL roles, all migrations table state Sanitization applied at the end of the dump (POST-LOAD block): - user.user_pass set to NULL (legacy AES-encrypted passwords; post-NFP-18 auth uses user_password_hash only) - user_settings values for keys matching token/key/secret/password/api set to empty string (devs add their own HF token, etc.) - user_password_hash for both default users reset to freshly-generated argon2id hashes that verify against the documented plaintexts bootstrap-db.sh adds NFP_USE_SNAPSHOT=1 to load this instead of the clean 3-file path. Both routes arrive at the same credentials. Verified end-to-end: - dump loads on a fresh DB (exit 0) - both default credentials authenticate via password_verify - all data rows preserved - no credential-shaped strings in non-comment lines --- README.md | 17 + bootstrap-db.sh | 55 ++- db/dev-snapshot.sql | 1060 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1111 insertions(+), 21 deletions(-) create mode 100644 db/dev-snapshot.sql diff --git a/README.md b/README.md index cacbc84..bddee4b 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,25 @@ 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@finetune.ai / admin123 and testuser@example.com / test123 +db/dev-snapshot.sql ← Stephan's working state with test data — 5 datasets, 1 job, + 1 model, etc. Secrets pre-scrubbed. Use this if you want + a populated platform instead of an empty one. ``` +## Two bootstrap modes + +**Clean install** (default) — empty platform, just users + reference data: +```bash +./bootstrap-db.sh +``` + +**Dev snapshot** — Stephan's local state with test data preloaded: +```bash +NFP_USE_SNAPSHOT=1 ./bootstrap-db.sh +``` + +Both arrive at the same credentials (`admin@finetune.ai/admin123`, `testuser@example.com/test123`). The snapshot just gives you something to look at on day 1. + ## TL;DR (10 min for experienced devs) ```bash diff --git a/bootstrap-db.sh b/bootstrap-db.sh index 87a5fe7..8e8ceee 100755 --- a/bootstrap-db.sh +++ b/bootstrap-db.sh @@ -8,13 +8,16 @@ # Defaults to the sibling repo at ../finetuning-plattform if not given. # # Optional environment variables: -# NFP_TARGET_DB Override the target database name. Useful for testing -# the bootstrap against a sandbox DB without wiping the -# platform's live data. Default: the value of -# MARIADB_DATABASE from local/.env. -# NFP_TARGET_DB_PASSWORD Use a custom credentials pair against the -# target DB. Defaults to MARIADB_USER / -# MARIADB_PASSWORD from local/.env. +# NFP_TARGET_DB Override the target database name. Useful for testing +# the bootstrap against a sandbox DB without wiping the +# platform's live data. Default: MARIADB_DATABASE from +# local/.env (i.e. neuronetz_finetune). +# +# NFP_USE_SNAPSHOT=1 Load db/dev-snapshot.sql (Stephan's working state with +# test data — 5 datasets, 1 job, 1 model, etc.) instead +# of the clean 3-file path. Default: 0 (clean install). +# Secrets are pre-scrubbed; both default credentials +# still authenticate (admin/admin123, test/test123). set -euo pipefail @@ -31,8 +34,8 @@ fi # shellcheck disable=SC1091 set -a; . "$PLATFORM_DIR/local/.env"; set +a -# Allow target DB override (NFP_TARGET_DB) for sandbox tests TARGET_DB="${NFP_TARGET_DB:-$MARIADB_DATABASE}" +USE_SNAPSHOT="${NFP_USE_SNAPSHOT:-0}" CONTAINER="neuro-finetuning-platform-mariadb-1" @@ -41,7 +44,12 @@ if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then exit 2 fi -echo "[1/4] Waiting for MariaDB to accept connections (target DB: ${TARGET_DB})..." +run_sql() { + local file=$1 + docker exec -i "$CONTAINER" mariadb -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" "$TARGET_DB" < "$file" +} + +echo "Waiting for MariaDB to accept connections (target: ${TARGET_DB})..." for i in {1..30}; do if docker exec "$CONTAINER" mariadb -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" -e "SELECT 1" "$TARGET_DB" >/dev/null 2>&1; then break @@ -49,20 +57,25 @@ for i in {1..30}; do sleep 1 done -echo "[2/4] Loading schema (01-schema.sql)..." -docker exec -i "$CONTAINER" mariadb -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" "$TARGET_DB" \ - < "$DELTA_DIR/db/01-schema.sql" - -echo "[3/4] Loading seed data (02-seed.sql)..." -docker exec -i "$CONTAINER" mariadb -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" "$TARGET_DB" \ - < "$DELTA_DIR/db/02-seed.sql" - -echo "[4/4] Loading default users (03-default-users.sql)..." -docker exec -i "$CONTAINER" mariadb -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" "$TARGET_DB" \ - < "$DELTA_DIR/db/03-default-users.sql" +if [[ "$USE_SNAPSHOT" == "1" ]]; then + echo "[snapshot] Loading dev-snapshot.sql (Stephan's working state)..." + run_sql "$DELTA_DIR/db/dev-snapshot.sql" +else + echo "[1/3] Loading schema (01-schema.sql)..." + run_sql "$DELTA_DIR/db/01-schema.sql" + echo "[2/3] Loading seed data (02-seed.sql)..." + run_sql "$DELTA_DIR/db/02-seed.sql" + echo "[3/3] Loading default users (03-default-users.sql)..." + run_sql "$DELTA_DIR/db/03-default-users.sql" +fi echo -echo "✓ Database '${TARGET_DB}' bootstrapped." +if [[ "$USE_SNAPSHOT" == "1" ]]; then + echo "✓ Database '${TARGET_DB}' bootstrapped from dev snapshot." + echo " Includes Stephan's test data: 5 datasets, 1 job (Support Bot v1), 1 model." +else + echo "✓ Database '${TARGET_DB}' bootstrapped from clean install." +fi echo echo " admin@finetune.ai / admin123 (superuser)" echo " testuser@example.com / test123 (user)" diff --git a/db/dev-snapshot.sql b/db/dev-snapshot.sql new file mode 100644 index 0000000..66e410e --- /dev/null +++ b/db/dev-snapshot.sql @@ -0,0 +1,1060 @@ +/*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 */; +DROP TABLE IF EXISTS `account`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `account` WRITE; +/*!40000 ALTER TABLE `account` DISABLE KEYS */; +INSERT INTO `account` (`account_id`, `account_name`, `account_active`, `account_email`) VALUES (1,'Admin Account',1,NULL); +/*!40000 ALTER TABLE `account` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `account_to_api_registry`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `account_to_api_registry` WRITE; +/*!40000 ALTER TABLE `account_to_api_registry` DISABLE KEYS */; +/*!40000 ALTER TABLE `account_to_api_registry` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `acl`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `acl` WRITE; +/*!40000 ALTER TABLE `acl` DISABLE KEYS */; +INSERT INTO `acl` (`acl_id`, `acl_role`) VALUES (1,'superuser'), +(2,'moderator'), +(3,'user'); +/*!40000 ALTER TABLE `acl` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `agent_templates`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `agent_templates` WRITE; +/*!40000 ALTER TABLE `agent_templates` DISABLE KEYS */; +/*!40000 ALTER TABLE `agent_templates` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `api_keys`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `api_keys` WRITE; +/*!40000 ALTER TABLE `api_keys` DISABLE KEYS */; +INSERT INTO `api_keys` (`api_keys_id`, `api_keys_user_id`, `api_keys_name`, `api_keys_hash`, `api_keys_prefix`, `api_keys_permissions`, `api_keys_last_used`, `api_keys_status`, `api_keys_created_at`) VALUES (1,1,'Recycler','$2y$10$Avb1bkTTovtsprQb53XBaexyr6ITGTYqCebLEoTP8FzFBq7ZxKr2.','ft_3ae0a8b','[\"read\",\"write\"]',NULL,'active','2025-12-20 03:58:21'); +/*!40000 ALTER TABLE `api_keys` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `api_registry`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `api_registry` WRITE; +/*!40000 ALTER TABLE `api_registry` DISABLE KEYS */; +/*!40000 ALTER TABLE `api_registry` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `chat_messages`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `chat_messages` WRITE; +/*!40000 ALTER TABLE `chat_messages` DISABLE KEYS */; +/*!40000 ALTER TABLE `chat_messages` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `chat_shares`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `chat_shares` WRITE; +/*!40000 ALTER TABLE `chat_shares` DISABLE KEYS */; +/*!40000 ALTER TABLE `chat_shares` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `datasets`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `datasets` WRITE; +/*!40000 ALTER TABLE `datasets` DISABLE KEYS */; +INSERT INTO `datasets` (`datasets_id`, `datasets_user_id`, `datasets_name`, `datasets_description`, `datasets_file_path`, `datasets_file_format`, `datasets_sample_count`, `datasets_file_size_bytes`, `datasets_status`, `datasets_validation_result`, `datasets_created_at`, `datasets_updated_at`) VALUES (1,1,'Customer Support Q&A','Training data for customer support chatbot',NULL,'jsonl',1250,2457600,'ready',NULL,'2025-12-12 14:50:06','2025-12-12 14:50:06'), +(2,1,'Synthetic - 20-year-old UNLV junior cheerl','Generated 1 samples about: 20-year-old UNLV junior cheerleader with a mortician’s soul. Ice-cold Scorpio art-history student who paints nightmares, plays doom metal, and hides real blood rituals behind a perfect back handspring. Speaks like she’s reading your eulogy. Will ruin your life or save it—50/50.','/var/www/html/uploads/datasets/1/dataset_693ecd9ca75f9.jsonl','jsonl',1,13960,'uploading',NULL,'2025-12-14 15:45:48','2025-12-14 15:45:48'), +(3,1,'Synthetic - 20-year-old UNLV junior cheerl','Generated 11 samples about: 20-year-old UNLV junior cheerleader with a mortician’s soul. Ice-cold Scorpio art-history student who paints nightmares, plays doom metal, and hides real blood rituals behind a perfect back handspring. Speaks like she’s reading your eulogy. Will ruin your life or save it—50/50.','/var/www/html/uploads/datasets/1/dataset_693f0eb9597d4.jsonl','jsonl',11,2553,'uploading',NULL,'2025-12-14 20:23:37','2025-12-14 20:23:37'), +(4,1,'Synthetic - eCommerce Support Assitant','Generated 5 samples about: eCommerce Support Assitant','/var/www/html/uploads/datasets/1/dataset_6941b9cbe65f3.jsonl','jsonl',5,1482,'uploading',NULL,'2025-12-16 20:58:03','2025-12-16 20:58:03'), +(5,1,'Synthetic - 20-year-old UNLV junior cheerl','Generated 10 samples about: 20-year-old UNLV junior cheerleader with a mortician’s soul. Ice-cold Scorpio art-history student who paints nightmares, plays doom metal, and hides real blood rituals behind a perfect back handspring. Speaks like she’s reading your eulogy. Will ruin your life or save it—50/50.','/var/www/html/uploads/datasets/1/dataset_69dbf62247e1a.jsonl','jsonl',10,1199,'uploading',NULL,'2026-04-12 21:44:34','2026-04-12 21:44:34'); +/*!40000 ALTER TABLE `datasets` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `email_notification_preferences`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `email_notification_preferences` WRITE; +/*!40000 ALTER TABLE `email_notification_preferences` DISABLE KEYS */; +INSERT INTO `email_notification_preferences` (`email_notification_preferences_id`, `email_notification_preferences_user_id`, `email_notification_preferences_type`, `email_notification_preferences_enabled`, `email_notification_preferences_created_at`, `email_notification_preferences_updated_at`) VALUES (1,1,'job-started',1,'2026-02-21 11:43:12','2026-02-21 11:52:01'), +(2,1,'low-credits',1,'2026-02-21 11:43:12','2026-02-21 11:52:01'); +/*!40000 ALTER TABLE `email_notification_preferences` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `email_queue`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `email_queue` WRITE; +/*!40000 ALTER TABLE `email_queue` DISABLE KEYS */; +INSERT INTO `email_queue` (`email_queue_id`, `email_queue_user_id`, `email_queue_template_slug`, `email_queue_to_email`, `email_queue_to_name`, `email_queue_subject`, `email_queue_body_html`, `email_queue_body_text`, `email_queue_status`, `email_queue_priority`, `email_queue_attempts`, `email_queue_max_attempts`, `email_queue_last_error`, `email_queue_scheduled_at`, `email_queue_sent_at`, `email_queue_created_at`) VALUES (1,1,'welcome','test@example.com','Test User','Welcome to Neuronetz Finetuning Platform','

Welcome, Test User!

Thank you for joining the Neuronetz Finetuning Platform. You can now start creating fine-tuning jobs, uploading datasets, and deploying models.

Get started at your dashboard.

','Welcome, Test User! Thank you for joining the Neuronetz Finetuning Platform.','pending',5,1,3,'SMTP send failed',NULL,NULL,'2026-02-21 11:43:06'), +(2,1,'welcome','admin@finetune.ai','Admin User','Welcome to Neuronetz Finetuning Platform','

Welcome, Admin!

Thank you for joining the Neuronetz Finetuning Platform. You can now start creating fine-tuning jobs, uploading datasets, and deploying models.

Get started at your dashboard.

','Welcome, Admin! Thank you for joining the Neuronetz Finetuning Platform.','pending',5,1,3,'SMTP send failed',NULL,NULL,'2026-02-21 11:52:01'), +(3,2,'welcome','testuser@example.com','Test User','Welcome to Neuronetz Finetuning Platform','

Welcome, {{user_name}}!

Thank you for joining the Neuronetz Finetuning Platform. You can now start creating fine-tuning jobs, uploading datasets, and deploying models.

Get started at your dashboard.

','Welcome, {{user_name}}! Thank you for joining the Neuronetz Finetuning Platform.','pending',5,0,3,NULL,NULL,NULL,'2026-02-21 12:09:57'); +/*!40000 ALTER TABLE `email_queue` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `email_templates`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `email_templates` WRITE; +/*!40000 ALTER TABLE `email_templates` DISABLE KEYS */; +INSERT INTO `email_templates` (`email_templates_id`, `email_templates_name`, `email_templates_slug`, `email_templates_subject`, `email_templates_body_html`, `email_templates_body_text`, `email_templates_variables`, `email_templates_is_active`, `email_templates_created_at`, `email_templates_updated_at`) VALUES (1,'Welcome Email','welcome','Welcome to Neuronetz Finetuning Platform','

Welcome, {{user_name}}!

Thank you for joining the Neuronetz Finetuning Platform. You can now start creating fine-tuning jobs, uploading datasets, and deploying models.

Get started at your dashboard.

','Welcome, {{user_name}}! Thank you for joining the Neuronetz Finetuning Platform.','[\"user_name\", \"user_email\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(2,'Email Verification','email-verification','Verify your email address','

Email Verification

Hi {{user_name}},

Please verify your email address by clicking the link below:

Verify Email

This link expires in 24 hours.

','Hi {{user_name}}, please verify your email: {{verification_url}}','[\"user_name\", \"verification_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(3,'Password Reset','password-reset','Reset your password','

Password Reset

Hi {{user_name}},

We received a request to reset your password. Click the link below to set a new password:

Reset Password

This link expires in 1 hour. If you did not request this, you can ignore this email.

','Hi {{user_name}}, reset your password here: {{reset_url}}','[\"user_name\", \"reset_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(4,'Job Started','job-started','Your fine-tuning job has started','

Job Started

Hi {{user_name}},

Your fine-tuning job {{job_name}} has started processing.

Base model: {{base_model}}
Epochs: {{epochs}}

View progress

','Hi {{user_name}}, your job \"{{job_name}}\" has started.','[\"user_name\", \"job_name\", \"base_model\", \"epochs\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(5,'Job Completed','job-completed','Your fine-tuning job completed successfully','

Job Completed!

Hi {{user_name}},

Your fine-tuning job {{job_name}} has completed successfully.

View results

','Hi {{user_name}}, your job \"{{job_name}}\" completed successfully.','[\"user_name\", \"job_name\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(6,'Job Failed','job-failed','Your fine-tuning job failed','

Job Failed

Hi {{user_name}},

Unfortunately, your fine-tuning job {{job_name}} has failed.

Error: {{error_message}}

View details

','Hi {{user_name}}, your job \"{{job_name}}\" failed: {{error_message}}','[\"user_name\", \"job_name\", \"error_message\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(7,'Low Credits Alert','low-credits','Low credits warning','

Low Credits

Hi {{user_name}},

Your account credits are running low. You have {{credits_remaining}} credits remaining.

View usage | Upgrade plan

','Hi {{user_name}}, you have {{credits_remaining}} credits remaining.','[\"user_name\", \"credits_remaining\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'), +(8,'Security Alert','security-alert','Security alert for your account','

Security Alert

Hi {{user_name}},

{{alert_message}}

If this was not you, please change your password immediately.

Account settings

','Hi {{user_name}}, security alert: {{alert_message}}','[\"user_name\", \"alert_message\", \"platform_url\"]',1,'2026-02-21 11:29:53','2026-02-21 11:29:53'); +/*!40000 ALTER TABLE `email_templates` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `gdpr_access_logs`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `gdpr_access_logs` WRITE; +/*!40000 ALTER TABLE `gdpr_access_logs` DISABLE KEYS */; +/*!40000 ALTER TABLE `gdpr_access_logs` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `gdpr_consent_records`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `gdpr_consent_records` WRITE; +/*!40000 ALTER TABLE `gdpr_consent_records` DISABLE KEYS */; +/*!40000 ALTER TABLE `gdpr_consent_records` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `gdpr_data_export_requests`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `gdpr_data_export_requests` WRITE; +/*!40000 ALTER TABLE `gdpr_data_export_requests` DISABLE KEYS */; +/*!40000 ALTER TABLE `gdpr_data_export_requests` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `gdpr_deletion_requests`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `gdpr_deletion_requests` WRITE; +/*!40000 ALTER TABLE `gdpr_deletion_requests` DISABLE KEYS */; +/*!40000 ALTER TABLE `gdpr_deletion_requests` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `handoff_messages`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `handoff_messages` WRITE; +/*!40000 ALTER TABLE `handoff_messages` DISABLE KEYS */; +/*!40000 ALTER TABLE `handoff_messages` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `handoff_requests`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `handoff_requests` WRITE; +/*!40000 ALTER TABLE `handoff_requests` DISABLE KEYS */; +/*!40000 ALTER TABLE `handoff_requests` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `handoff_triggers`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `handoff_triggers` WRITE; +/*!40000 ALTER TABLE `handoff_triggers` DISABLE KEYS */; +/*!40000 ALTER TABLE `handoff_triggers` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `jobs`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `jobs` WRITE; +/*!40000 ALTER TABLE `jobs` DISABLE KEYS */; +INSERT INTO `jobs` (`jobs_id`, `jobs_user_id`, `jobs_name`, `jobs_base_model`, `jobs_dataset_id`, `jobs_status`, `jobs_progress`, `jobs_epochs`, `jobs_learning_rate`, `jobs_batch_size`, `jobs_hyperparameters`, `jobs_result_model_id`, `jobs_error_message`, `jobs_started_at`, `jobs_completed_at`, `jobs_created_at`) VALUES (1,1,'Support Bot v1','llama3.2:3b',1,'completed',100,3,0.00002000,4,NULL,NULL,NULL,'2025-12-10 14:30:00','2025-12-10 16:45:00','2025-12-10 14:00:00'); +/*!40000 ALTER TABLE `jobs` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `knowledge_base_chunks`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `knowledge_base_chunks` WRITE; +/*!40000 ALTER TABLE `knowledge_base_chunks` DISABLE KEYS */; +/*!40000 ALTER TABLE `knowledge_base_chunks` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `knowledge_base_documents`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `knowledge_base_documents` WRITE; +/*!40000 ALTER TABLE `knowledge_base_documents` DISABLE KEYS */; +/*!40000 ALTER TABLE `knowledge_base_documents` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `migrations`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `migrations` WRITE; +/*!40000 ALTER TABLE `migrations` DISABLE KEYS */; +INSERT INTO `migrations` (`id`, `version`, `filename`, `migrated`) VALUES (1,1,'001-acl.sql',1), +(2,2,'002-account.sql',1), +(3,3,'003-api_registry.sql',1), +(4,4,'004-timeanddate.sql',1), +(5,5,'005-user.sql',1), +(6,6,'006-user_to_account.sql',1), +(7,7,'007-timeanddate_to_account.sql',1), +(8,8,'008-user_to_acl.sql',1), +(9,9,'009-account_to_api_registry.sql',1), +(10,10,'010-timeanddate_to_user.sql',1), +(11,11,'011-acl-data.sql',1), +(12,12,'012-add-unique-key-user.sql',1), +(13,13,'013-add-account-email.sql',1), +(14,14,'014-jobs.sql',1), +(15,15,'015-datasets.sql',1), +(16,16,'016-models.sql',1), +(17,17,'017-api_keys.sql',1), +(18,18,'018-user_settings.sql',1), +(19,19,'019-usage_logs.sql',1), +(20,20,'020-user_billing.sql',1), +(21,21,'021-rename-jobs-columns.sql',1), +(22,22,'022-rename-datasets-columns.sql',1), +(23,23,'023-rename-models-columns.sql',1), +(24,24,'024-rename-api_keys-columns.sql',1), +(25,25,'025-rename-user_settings-columns.sql',1), +(26,26,'026-rename-usage_logs-columns.sql',1), +(27,27,'027-rename-user_billing-columns.sql',1), +(28,28,'028-agent_templates.sql',1), +(29,29,'029-email_templates.sql',1), +(30,30,'030-email_queue.sql',1), +(31,31,'031-email_notification_preferences.sql',1); +/*!40000 ALTER TABLE `migrations` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `model_pulls`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `model_pulls` WRITE; +/*!40000 ALTER TABLE `model_pulls` DISABLE KEYS */; +INSERT INTO `model_pulls` (`pull_id`, `user_id`, `model_name`, `status`, `progress`, `total_size`, `downloaded_size`, `error_message`, `started_at`, `completed_at`) VALUES (1,0,'deepseek-coder','completed',100,776080839,776080839,NULL,'2025-12-16 18:38:21','2025-12-16 18:40:03'); +/*!40000 ALTER TABLE `model_pulls` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `modelfiles`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `modelfiles` WRITE; +/*!40000 ALTER TABLE `modelfiles` DISABLE KEYS */; +/*!40000 ALTER TABLE `modelfiles` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `models`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `models` WRITE; +/*!40000 ALTER TABLE `models` DISABLE KEYS */; +INSERT INTO `models` (`models_id`, `models_user_id`, `models_job_id`, `models_name`, `models_base_model`, `models_path`, `models_modelfile_content`, `models_metrics`, `models_status`, `models_created_at`, `models_updated_at`) VALUES (1,1,1,'support-bot-v1','llama3.2:3b',NULL,NULL,'{\"loss\": 0.0234, \"accuracy\": 0.94}','ready','2025-12-12 14:50:06','2025-12-12 14:50:06'); +/*!40000 ALTER TABLE `models` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `test_sessions`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `test_sessions` WRITE; +/*!40000 ALTER TABLE `test_sessions` DISABLE KEYS */; +/*!40000 ALTER TABLE `test_sessions` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `timeanddate`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `timeanddate` WRITE; +/*!40000 ALTER TABLE `timeanddate` DISABLE KEYS */; +INSERT INTO `timeanddate` (`timeanddate_id`, `timeanddate_date`, `timeanddate_time`) VALUES (1,'2025-12-12','2025-12-12 12:18:40'); +/*!40000 ALTER TABLE `timeanddate` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `timeanddate_to_account`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `timeanddate_to_account` WRITE; +/*!40000 ALTER TABLE `timeanddate_to_account` DISABLE KEYS */; +INSERT INTO `timeanddate_to_account` (`account_id`, `timeanddate_id`) VALUES (1,1); +/*!40000 ALTER TABLE `timeanddate_to_account` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `timeanddate_to_user`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `timeanddate_to_user` WRITE; +/*!40000 ALTER TABLE `timeanddate_to_user` DISABLE KEYS */; +INSERT INTO `timeanddate_to_user` (`timeanddate_id`, `user_id`) VALUES (1,1); +/*!40000 ALTER TABLE `timeanddate_to_user` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `usage_logs`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `usage_logs` WRITE; +/*!40000 ALTER TABLE `usage_logs` DISABLE KEYS */; +/*!40000 ALTER TABLE `usage_logs` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `user`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` (`user_id`, `user_firstname`, `user_lastname`, `user_email`, `user_name`, `user_pass`, `user_password_hash`, `user_login`, `user_account_active`, `user_created`) VALUES (1,'Admin','User','admin@finetune.ai','Admin User','vqY`]','$argon2id$v=19$m=65536,t=4,p=1$TWtKVkZVMUFvR0lFeUM3Ug$yj9Bs5kXVa/vkxqCas+ax8lBI3yblFlpQCX23Vz4vnI','admin@finetune.ai',1,'2025-12-12 13:18:40'), +(2,NULL,NULL,'testuser@example.com','Test User','!yDPԺTY','$argon2id$v=19$m=65536,t=4,p=1$WW56SlJHQ1o4NWhUVktjbw$6yLWMHdEI+dVPH4KyWBv/89hIrTJKx5VJyT/ognvG0I','testuser@example.com',1,'2026-02-21 12:09:37'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `user_billing`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `user_billing` WRITE; +/*!40000 ALTER TABLE `user_billing` DISABLE KEYS */; +INSERT INTO `user_billing` (`user_billing_id`, `user_billing_user_id`, `user_billing_plan_type`, `user_billing_credits_balance`, `user_billing_credits_used_month`, `user_billing_cycle_start`, `user_billing_cycle_end`, `user_billing_stripe_customer_id`, `user_billing_paypal_customer_id`, `user_billing_created_at`, `user_billing_updated_at`) VALUES (1,1,'enterprise',10000.0000,234.5000,'2025-12-01','2025-12-31',NULL,NULL,'2025-12-12 14:50:06','2025-12-12 14:50:06'); +/*!40000 ALTER TABLE `user_billing` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `user_settings`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `user_settings` WRITE; +/*!40000 ALTER TABLE `user_settings` DISABLE KEYS */; +INSERT INTO `user_settings` (`user_settings_id`, `user_settings_user_id`, `user_settings_key`, `user_settings_value`, `user_settings_created_at`, `user_settings_updated_at`) VALUES (1,1,'huggingface_api_key','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','2025-12-12 14:50:06','2025-12-12 16:17:44'), +(2,1,'ollama_api_endpoint','http://localhost:11434','2025-12-12 14:50:06','2025-12-12 14:50:06'), +(3,1,'notification_email','1','2025-12-12 14:50:06','2025-12-12 14:50:06'), +(4,1,'notification_slack','0','2025-12-12 14:50:06','2025-12-12 14:50:06'), +(5,1,'theme','dark','2025-12-12 14:50:06','2025-12-12 14:50:06'); +/*!40000 ALTER TABLE `user_settings` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `user_to_account`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `user_to_account` WRITE; +/*!40000 ALTER TABLE `user_to_account` DISABLE KEYS */; +INSERT INTO `user_to_account` (`account_id`, `user_id`) VALUES (1,1); +/*!40000 ALTER TABLE `user_to_account` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +DROP TABLE IF EXISTS `user_to_acl`; +/*!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 */; + +SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; +LOCK TABLES `user_to_acl` WRITE; +/*!40000 ALTER TABLE `user_to_acl` DISABLE KEYS */; +INSERT INTO `user_to_acl` (`user_id`, `acl_id`) VALUES (1,1); +/*!40000 ALTER TABLE `user_to_acl` ENABLE KEYS */; +UNLOCK TABLES; +COMMIT; +SET AUTOCOMMIT=@OLD_AUTOCOMMIT; +/*!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 */; + + +-- ───────────────────────────────────────────────────────────────────── +-- POST-LOAD SANITIZATION +-- This snapshot dump originally included two categories of dev-only +-- secrets that have been scrubbed: +-- 1. user.user_pass (legacy AES-encrypted plaintext password). Post +-- NFP-18, authentication uses argon2id via user_password_hash; the +-- legacy column is unused. We NULL it here to avoid shipping +-- AES blobs that an attacker with the AES key could decrypt. +-- 2. user_settings.user_settings_value for credential-shaped keys +-- (anything matching token/key/secret/password/api). New devs +-- should set their own values via /settings. +-- ───────────────────────────────────────────────────────────────────── +UPDATE `user` SET `user_pass` = NULL; +UPDATE `user_settings` + SET `user_settings_value` = '' + WHERE `user_settings_key` LIKE '%token%' + OR `user_settings_key` LIKE '%key%' + OR `user_settings_key` LIKE '%secret%' + OR `user_settings_key` LIKE '%password%' + OR `user_settings_key` LIKE '%api%'; +-- Reset user_password_hash to known plaintexts for both default users. +-- The hash in the live snapshot won't match because testuser's actual +-- password in the source DB was different. These hashes both verify +-- against the documented credentials (admin123 and test123). +UPDATE `user` SET `user_password_hash` = '$argon2id$v=19$m=65536,t=4,p=1$UWZkNzh4dm02M3UyN0lKQw$rMcCtC8yjsc2ZJKgMn9YPmnVaJpgN43Qh32VWojSIa4' WHERE `user_id` = 1; +UPDATE `user` SET `user_password_hash` = '$argon2id$v=19$m=65536,t=4,p=1$Q2V3OUVWS0VLR1JCZ0dlQQ$BTQ9vPV+MJ6sGu+s4PdT3q+mJh6aCjL0yOUNzhPvkH4' WHERE `user_id` = 2;