# Database

## Database

Uses MySQL via `oxmysql`.

### Table Structure

```sql
CREATE TABLE IF NOT EXISTS `elena_banmenu` (
    `id` INT AUTO_INCREMENT,
    `ban_id` VARCHAR(50) UNIQUE,
    `name` VARCHAR(100),
    `reason` TEXT,
    `banned_by` VARCHAR(100),
    `banned_at` BIGINT,
    `expires` BIGINT DEFAULT -1,
    `duration` BIGINT DEFAULT -1,
    `license` VARCHAR(100),
    `steam` VARCHAR(100),
    `discord` VARCHAR(100),
    `ip` VARCHAR(100),
    PRIMARY KEY (`id`)
);
```

### Useful Queries

View active bans:

```sql
SELECT * FROM elena_banmenu 
WHERE expires = -1 OR expires > UNIX_TIMESTAMP();
```

Remove all bans:

```sql
TRUNCATE TABLE elena_banmenu;
```

Find by player name:

```sql
SELECT * FROM elena_banmenu WHERE name LIKE '%PlayerName%';
```

### Automatic Cleanup

Expired bans are removed automatically every hour.


---

# 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/ban-menu/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.
