# AddDatabase

- Module: [Aspire.Hosting.ClickHouse](/reference/api/go/aspire.hosting.clickhouse.md)
- Version: `13.5.3`
- Kind: `method`
- Defined on: [`ClickHouseServerResource`](/reference/api/go/aspire.hosting.clickhouse/clickhouseserverresource.md)
- Source: [GitHub](https://github.com/ClickHouse/ClickHouse.Aspire/tree/cabd9edc0899714407e6ad81dc4954eb01302af0)

Adds a ClickHouse database to the application model.

## Definition

```go
func (ClickHouseServerResource) AddDatabase(
    name string,
    options ...*AddDatabaseOptions,
) ClickHouseDatabaseResource
```

## Parameters

- `name` (`string`) -- The name of the resource. This name will be used as the connection string name when referenced in a dependency.
- `options` (`...*AddDatabaseOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddDatabaseOptions` argument.

- `DatabaseName` (`*string`) -- The name of the database. If not provided, this defaults to the same value as `name`.

## Returns

[`ClickHouseDatabaseResource`](/reference/api/go/aspire.hosting.clickhouse/clickhousedatabaseresource.md) -- The ClickHouse database resource.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`ClickHouseServerResource`](/reference/api/go/aspire.hosting.clickhouse/clickhouseserverresource.md)
