# Database

URL: https://developers.cloud66.com/v3/models/database/

Databases represent database instances within server groups that support database operations. They contain database-specific configuration, size metrics, and connection information.

<Model>
    <ModelProperty name="uid" type="string">
        The unique identifier of the database.
    </ModelProperty>
    <ModelProperty name="stack_uid" type="string">
        The unique identifier of the stack that owns this database.
    </ModelProperty>
    <ModelProperty name="server_group_id" type="integer">
        The ID of the server group that hosts this database.
    </ModelProperty>
    <ModelProperty name="database_name" type="string">
        The name of the database.
    </ModelProperty>
    <ModelProperty name="collation" type="string">
        The collation setting for the database (e.g., "utf8mb4_unicode_ci").
    </ModelProperty>
    <ModelProperty name="encoding" type="string">
        The character encoding for the database (e.g., "utf8mb4").
    </ModelProperty>
    <ModelProperty name="size_bytes" type="integer">
        The size of the database in bytes.
    </ModelProperty>
    <ModelProperty name="size_rows" type="integer">
        The number of rows across all tables in the database.
    </ModelProperty>
    <ModelProperty name="created_at_iso" type="string">
        The ISO 8601 timestamp when the database was created.
    </ModelProperty>
    <ModelProperty name="updated_at_iso" type="string">
        The ISO 8601 timestamp when the database was last updated.
    </ModelProperty>
</Model>

**Related models:** Server Group, Stack, Database User

## Example

```json
{
  "uid": "database-456def789",
  "stack_uid": "stack-abc123",
  "server_group_id": 567,
  "database_name": "myapp_production",
  "collation": "utf8mb4_unicode_ci",
  "encoding": "utf8mb4",
  "size_bytes": 1073741824,
  "size_rows": 250000,
  "created_at_iso": "2023-01-15T10:30:00Z",
  "updated_at_iso": "2024-01-15T09:15:00Z"
}
```
