-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
48 lines (43 loc) · 1.49 KB
/
database.sql
File metadata and controls
48 lines (43 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- ====================================================
-- SPERO BROWSER - Database Setup
-- Run this in phpMyAdmin > SQL tab
-- ====================================================
CREATE DATABASE IF NOT EXISTS spero_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE spero_db;
-- Users table
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) NOT NULL,
email VARCHAR(150) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Command history table
CREATE TABLE IF NOT EXISTS command_history (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
command TEXT NOT NULL,
ai_reply TEXT,
action_taken VARCHAR(100),
url_opened TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- User preferences table
CREATE TABLE IF NOT EXISTS user_preferences (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL UNIQUE,
voice_enabled TINYINT(1) DEFAULT 1,
gesture_enabled TINYINT(1) DEFAULT 0,
theme VARCHAR(50) DEFAULT 'cherry',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Proxy cache table
CREATE TABLE IF NOT EXISTS proxy_cache (
id INT AUTO_INCREMENT PRIMARY KEY,
url VARCHAR(500) NOT NULL UNIQUE,
content LONGTEXT,
cached_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
expires_at TIMESTAMP NULL
);