# PostgresDatabaseResource

- Module: [Aspire.Hosting.Azure.PostgreSQL](/reference/api/typescript/aspire.hosting.azure.postgresql.md)
- Version: `13.2.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface PostgresDatabaseResource
  extends IManifestExpressionProvider,
    IResource,
    IResourceWithConnectionString,
    IResourceWithParent,
    PostgresServerResource]],
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly databaseName: string;
  readonly jdbcConnectionString: ReferenceExpression;
  readonly name: string;
  readonly parent: PostgresServerResource;
  readonly uriExpression: ReferenceExpression;
  withCreationScript(script: string): PostgresDatabaseResource;
  withPostgresMcp(configureContainer?: (obj: PostgresMcpContainerResource) => Promise<void>, containerName?: string): PostgresDatabaseResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the ConnectionStringExpression property
- `databaseName`: `string` `get` -- Gets the DatabaseName property
- `jdbcConnectionString`: `ReferenceExpression` `get` -- Gets the JdbcConnectionString property
- `name`: `string` `get` -- Gets the Name property
- `parent`: [PostgresServerResource](/reference/api/typescript/aspire.hosting.azure.postgresql/postgresserverresource.md) `get` -- Gets the Parent property
- `uriExpression`: `ReferenceExpression` `get` -- Gets the UriExpression property

## Methods

- [withCreationScript](/reference/api/typescript/aspire.hosting.azure.postgresql/postgresdatabaseresource/withcreationscript.md) -- `method` -- Defines the SQL script for database creation
    ```typescript
  withCreationScript(script: string): PostgresDatabaseResource
  ```
- [withPostgresMcp](/reference/api/typescript/aspire.hosting.azure.postgresql/postgresdatabaseresource/withpostgresmcp.md) -- `method` -- Adds Postgres MCP server
    ```typescript
  withPostgresMcp(configureContainer?: (obj: PostgresMcpContainerResource) => Promise<void>, containerName?: string): PostgresDatabaseResource
  ```
