# Database

Elena Chat uses **MySQL** to store player preferences.

### 📊 Table Structure

Auto-created on first start:

```sql
CREATE TABLE elena_chat_settings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    identifier VARCHAR(64) UNIQUE,
    accent_color VARCHAR(10),
    background_opacity FLOAT,
    font_size INT,
    position_x INT,
    position_y INT,
    settings_position_x INT,
    settings_position_y INT,
    fade_time INT,
    show_timestamp TINYINT,
    sound_enabled TINYINT,
    show_3d_text TINYINT,
    language VARCHAR(5),
    created_at TIMESTAMP,
    updated_at TIMESTAMP
);
```

### 🔧 Configuration

Disable database in `config/config.lua`:

```lua
Config.Database = {
    enabled = false  -- Disables DB, uses LocalStorage only
}
```

### 📝 What's Saved?

* 🎨 Accent color
* 🌫️ Background opacity
* 🔠 Font size
* 📍 Chat & settings position
* ⏱️ Fade time
* 🔧 All toggles
* 🌍 Language preference

### 🔍 View Player Settings

```sql
SELECT * FROM elena_chat_settings 
WHERE identifier = 'license:XXX';
```

### 🗑️ Reset Player

```sql
DELETE FROM elena_chat_settings 
WHERE identifier = 'license:XXX';
```

Or in-game: `/chatset` → "Reset All Settings"

> ✅ Identifier: Player's **license** identifier (unique).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://elena-scripts.gitbook.io/elenascripts/core-systems/chat/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
