# PostgreSQL

PostgreSQL is a robust open-source relational database. Known for its reliability and data integrity, it's ideal for applications needing advanced data operations.

**Integration with LightningUserVault**:

To use PostgreSQL within LightningUserVault, ensure the `STORAGE_TYPE` is set to `POSTRESQL`.

#### 🛠️Configuration Commands:

* **DB\_HOST**: Address of your database host. Default: `postgres:5432`
* **DB\_USER**: Username for your database. Default: `postgres`
* **DB\_PASS**: Password for your database user. Default: `postgres`
* **DB\_NAME**: Name of your database. Default: `postgres`

🔄 **Go Integration**:\
For seamless integration with Go, we've employed the ORM called [GORM](https://github.com/go-gorm/gorm). It simplifies database operations and ensures type-safe data manipulations

🔄 **Auto-Migration**:\
On server start, LightningUserVault performs an auto-migration to ensure the necessary tables and items are in place. Here's a glimpse of the user table structure:

```
type User struct {
    ID   int64  `gorm:"primaryKey"`
    Name string `gorm:"type:varchar(255)"`
}
```


---

# 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://gotolabs.gitbook.io/lightninguservault/architecture/data-storage/sql-databases/postgresql.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.
