# What is a database?

This library creates a database when you first use it.\
Databases are used by developers to store information for as long as its nessecary.\
\
Databases are made up of tables, those tables hold the actual information. This library will create two tables in the database.

## Table schema

### Voters

The voters table holds vote information. It contains two columns.\
The voters ID, and the time the vote occurred at.

{% tabs %}
{% tab title="Schema" %}
When a user votes their Discord ID and the current time is saved.\
The library will then periodically check this table for any votedAt timestamps that occured 12 hours ago or more. If a vote is expired it will be deleted from your database.

| Column       | Description                     |
| ------------ | ------------------------------- |
| id           | The voters Discord Id           |
| votedAt      | The timestamp the user voted at |
| {% endtab %} |                                 |

{% tab title="Example" %}

| ID                   | votedAt       |
| -------------------- | ------------- |
| "311553339261321216" | 1669738439228 |
| "136583532972605440" | 1669755535947 |
| "264811613708746752" | 1669732335351 |
| {% endtab %}         |               |
| {% endtabs %}        |               |

### voterOptions

The voterOptions table holds any options a user sets. The only setting is currently opting in or out of vote reminders.

{% tabs %}
{% tab title="Schema" %}
Before the reminder event is fired this database is checked, if a user is opted in to reminders OR the reminders are enabled by default the reminder event is fired. Otherwise it will not fire for that user.

<table><thead><tr><th width="174">Column</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>The voters Discord ID</td></tr><tr><td>optIn</td><td>If the voter wants voting reminders</td></tr></tbody></table>
{% endtab %}

{% tab title="Example" %}

| ID                   | optIn |
| -------------------- | ----- |
| "311553339261321216" | false |
| "264811613708746752" | true  |
| {% endtab %}         |       |
| {% endtabs %}        |       |


---

# 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://top-gg.gitbook.io/top.gg-voting-node-sdk/faq/what-is-a-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.
