# PostgresDatabaseResource.WithCreationScript

- Module: [Aspire.Hosting.PostgreSQL](/reference/api/go/aspire.hosting.postgresql.md)
- Defined on: [PostgresDatabaseResource](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md)
- Version: `17.0.0`
- Kind: `method`

Defines the SQL script used to create the database.

## Remarks

The script can only contain SQL statements applying to the default database like CREATE DATABASE. Custom statements like table creation
and data insertion are not supported since they require a distinct connection to the newly created database.
Default script is
```
CREATE DATABASE "<QUOTED_DATABASE_NAME>"
```

## Definition

```go
type PostgresDatabaseResource interface {
    // ... omitted for brevity
    WithCreationScript(script string) PostgresDatabaseResource
}
```

## Signature

```go
WithCreationScript(script string) PostgresDatabaseResource
```

## Parameters

- `script` (`string`) -- The SQL script used to create the database.

## Returns

[`PostgresDatabaseResource`](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md) -- The resource builder.

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

## Defined on

- [PostgresDatabaseResource](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md) -- `handle`
