# The Database object

Database represents a Postgres database within a Branch.

## Attributes

- `name` (string, ID, Immutable)
  The resource name of the database.
   Format: projects/{project_id}/branches/{branch_id}/databases/{database_id}
- `parent` (string, Output only)
  The branch containing this database.
   Format: projects/{project_id}/branches/{branch_id}
- `create_time` (string, Output only)
  A timestamp indicating when the database was created.
- `update_time` (string, Output only)
  A timestamp indicating when the database was last updated.
- `spec` (object)
  The desired state of the Database.
  
   Read the resource's current values from `status`, rather than `spec`.
   `spec` tracks field ownership for infrastructure-as-code tools and may omit
   unmanaged fields.
  - `role` (string)
    The name of the role that owns the database.
     Format: projects/{project_id}/branches/{branch_id}/roles/{role_id}
    
     The role must be in the same branch as the database.
     To change the owner, pass valid existing Role name when updating the Database
    
     Required when creating the Database.
  - `postgres_database` (string)
    The name of the Postgres database.
    
     This expects a valid Postgres identifier as specified in the link below.
     https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
     Required when creating the Database.
    
     To rename, pass a valid postgres identifier when updating the Database.
- `status` (object, Output only)
  The observed state of the Database.
  - `role` (string)
    The name of the role that owns the database.
     Format: projects/{project_id}/branches/{branch_id}/roles/{role_id}
  - `postgres_database` (string)
    The name of the Postgres database.
  - `database_id` (string, Output only)
    Part of the resource name.
- `database_id` (string, Output only)
  The part of the name, chosen by the user when the resource was created.

## Example

### Application database owned by the app-owner role

```json
{
  "name": "projects/inventory-app/branches/production/databases/orders",
  "parent": "projects/inventory-app/branches/production",
  "create_time": "2026-11-11T10:05:12Z",
  "update_time": "2026-11-11T10:05:12Z",
  "status": {
    "role": "projects/inventory-app/branches/production/roles/app-owner",
    "postgres_database": "orders",
    "database_id": "orders"
  },
  "database_id": "orders"
}
```


