# Database structure

{% hint style="danger" %}
**Please note:** This page is under construction and has not been finished yet.
{% endhint %}

## Introduction

### Best practices

* **Do not modify the core database structure**

:thumbsup: Use your own tables (for example by [creating a plugin](https://devguide.e107.org/plugin-development/introduction)) if you want to work with additional data in the database. &#x20;

* **Do not (ab)use database tables and fields for other purposes**&#x20;

:thumbsup: Stick to purposes [defined in the database tables](#database-tables-overview) overview, or create your own database tables

### Database prefix

The default database table prefix is `e107_` and can be customized by the user during the installation of e107. The prefix that is used on an installation can always be found in the `e107_config.php` file.&#x20;

There are several ways the database prefix is used:

1. **Recommended:** It is strongly recommend to make use of the [database methods](https://devguide.e107.org/classes-and-methods/database#database-methods). Using these methods, the database table prefix is processed automatically. <br>
2. By using the `#` sign, one can automatically refer to the database prefix. This is generally used when using the[ e107::getDB()->gen()](https://devguide.e107.org/classes-and-methods/database#gen) method, to manually construct an SQL query. <br>
3. In rare cases, you may reference the `MPREFIX` constant. Its use is deprecated and **not** encouraged.&#x20;

## Database tables overview&#x20;

{% hint style="info" %}
TODO: Finish table below.&#x20;
{% endhint %}

The following table provides an overview of all database tables in a clean e107 installation, with their respective purposes.&#x20;

| Table name         | Description                                                                                                                                                                    |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| admin\_log         |                                                                                                                                                                                |
| audit\_log         |                                                                                                                                                                                |
| banlist            |                                                                                                                                                                                |
| comments           |                                                                                                                                                                                |
| core               |                                                                                                                                                                                |
| core\_media        |                                                                                                                                                                                |
| core\_media\_cat   |                                                                                                                                                                                |
| cron               |                                                                                                                                                                                |
| dblog              |                                                                                                                                                                                |
| generic            | <p>Table for generic purposes. Generally used to store temporary date. Currently also used by welcome message. <br><em>Developers are discouraged to use this table!</em> </p> |
| links              |                                                                                                                                                                                |
| mail\_recipients   |                                                                                                                                                                                |
| mail\_content      |                                                                                                                                                                                |
| menus              |                                                                                                                                                                                |
| news               |                                                                                                                                                                                |
| news\_category     |                                                                                                                                                                                |
| online             |                                                                                                                                                                                |
| page               |                                                                                                                                                                                |
| page\_chapters     |                                                                                                                                                                                |
| plugin             |                                                                                                                                                                                |
| rate               |                                                                                                                                                                                |
| submitnews         |                                                                                                                                                                                |
| tmp                |                                                                                                                                                                                |
| upload             |                                                                                                                                                                                |
| user               |                                                                                                                                                                                |
| userclass\_classes |                                                                                                                                                                                |
| user\_extended     |                                                                                                                                                                                |
|                    |                                                                                                                                                                                |
