27 lines
1.1 KiB
SQL
27 lines
1.1 KiB
SQL
CREATE TABLE IF NOT EXISTS chats (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
title VARCHAR(255) DEFAULT 'New Chat',
|
|
mode ENUM('regular', 'coding', 'game', 'app') DEFAULT 'regular',
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS messages (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
chat_id INT NOT NULL,
|
|
role ENUM('user', 'assistant', 'system') NOT NULL,
|
|
content TEXT NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS user_settings (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
setting_key VARCHAR(50) UNIQUE NOT NULL,
|
|
setting_value TEXT,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Default settings
|
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('creativity', '0.7');
|
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('theme', 'theme-dark-modern');
|
|
INSERT IGNORE INTO user_settings (setting_key, setting_value) VALUES ('limits_off', '0'); |