> ## Documentation Index
> Fetch the complete documentation index at: https://tygress.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrations

For migrations to work you need to specify a migration folder in your <Tooltip tip="PostgresClient class, main interface with Tygress">client</Tooltip>:

```typescript tygress-client.ts theme={null}
import { PostgresClient } from "tygress";

export default new PostgresClient({
  databaseUrl: "postgres://username:password@host:5432/database",
  entities: [Users],

  // Needed for migrations to work
  migrationFolders: [path.join(__dirname, "migrations")],
});
```

# CLI

For the CLI to be able to use the `PostgresClient` you defined you can pass the path to it using `--config ./src/database.ts` or put the <Tooltip tip="PostgresClient class, main interface with Tygress">client</Tooltip> in `tygress-client.ts` in your project root.

# Commands

## db:create

Creates your database. Connects to postgres database with the auth provided in your <Tooltip tip="PostgresClient class, main interface with Tygress">client</Tooltip> config.

## migration:generate Name

Generates a migration that will make your DB match your <Tooltip tip="Classes and decorators that define your schema">entities</Tooltip>

## migration:blank Name

Creates an empty migration

## migration:run

Runs all pending migrations

## migration:rollback

Rolls the last executed migration back
