[**Documentation**](../../../README)

***

[Documentation](../../../README) / [zerotal](../../README) / [orm](../README) / DatabaseConfigShape

# Interface: DatabaseConfigShape

Defined in: [packages/orm/src/config.ts:9](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L9)

Shape of the `database` config namespace produced by [DatabaseConfig](../functions/DatabaseConfig).
Consumed by [DatabaseProvider](../classes/DatabaseProvider) to build the connection, read replicas,
pool, and auto-sync behaviour.

## Properties

### driver

> **driver**: `"sqlite"` \| `"postgres"` \| `"mysql"`

Defined in: [packages/orm/src/config.ts:11](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L11)

Database driver. Default: 'sqlite'

***

### url

> **url**: `string`

Defined in: [packages/orm/src/config.ts:13](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L13)

Connection URL. Default: './database/db.sqlite'

***

### replicas?

> `optional` **replicas?**: `string`[]

Defined in: [packages/orm/src/config.ts:28](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L28)

Read-replica connection URLs.

When one or more replicas are configured, the ORM automatically routes
SELECT / WITH / EXPLAIN queries to replicas (round-robin) and all
mutating queries (INSERT, UPDATE, DELETE, DDL) plus transactions to the
primary. No code changes are required in controllers or models.

#### Example

```ts
replicas: [
  env('REPLICA_1_URL'),
  env('REPLICA_2_URL'),
]
```

***

### pool?

> `optional` **pool?**: `object`

Defined in: [packages/orm/src/config.ts:33](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L33)

Connection pool options (PostgreSQL and MySQL only).
Bun.sql manages the pool automatically - these tune its behaviour.

#### max?

> `optional` **max?**: `number`

Maximum number of connections in the pool. Default: 10

#### idleTimeout?

> `optional` **idleTimeout?**: `number`

Seconds an idle connection is kept before being closed. Default: 30

***

### sqlite

> **sqlite**: `object`

Defined in: [packages/orm/src/config.ts:40](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L40)

SQLite-specific options

#### path

> **path**: `string`

Path to the SQLite file. Use ':memory:' for in-memory database.

***

### synchronize?

> `optional` **synchronize?**: `boolean` \| \{ `enabled`: `boolean`; `disruptive?`: `boolean`; \}

Defined in: [packages/orm/src/config.ts:58](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/config.ts#L58)

Auto-sync the schema to your models at boot (TypeORM-style). Opt-in, and
hard-off in production regardless of this value.

- `false` (default): never sync; use generated migrations.
- `true`: additive sync - create missing tables, add missing columns. Never drops.
- `{ enabled, disruptive }`: set `disruptive: true` to also DROP columns that no
  model declares anymore (destroys their data - local/test only).

#### Example

```ts
synchronize: env("APP_ENV") !== "production"          // additive
synchronize: { enabled: true, disruptive: false }     // explicit, additive
synchronize: { enabled: true, disruptive: true }      // also drops removed columns
```
