# PostgreSQL

Source : https://webgune.cloud/en-us/docs/db-postgresql · Mis à jour le 2026-10-27

# PostgreSQL

The recommended default engine for most relational applications.

## Connection string

```bash
DATABASE_URL=postgresql://user:password@host:5432/dbname
# with SSL, if your client requires it
DATABASE_URL=postgresql://user:password@host:5432/dbname?sslmode=require
```

## Prisma

```prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id        String   @id @default(uuid())
  email     String   @unique
  createdAt DateTime @default(now())
}
```

```bash
npx prisma migrate deploy
```

## SQLAlchemy (Python)

```python
from sqlalchemy import create_engine

engine = create_engine(os.environ["DATABASE_URL"])
```

## Best practices

- Use the **internal URL** for connections from your application services. The public URL is reserved for administration tools.
- Put migrations in your deployment pipeline (`prisma migrate deploy`, `alembic upgrade head`…) rather than running them by hand.
- Index the columns used in your `WHERE` and `JOIN` clauses. Webgune does not do it on your behalf.
