Skip to content

Commit

Permalink
feat(docs): update drizzle recipe to add docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
tszhong0411 committed Feb 6, 2025
1 parent 1c28cad commit 40ab04f
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions apps/docs/src/content/recipes/drizzle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pnpm add -D drizzle-kit @types/pg
Create a `.env` file in the root of your project and add the following:

```properties
DATABASE_URL="postgres://postgres:postgres@localhost:5432/database-name"
DATABASE_URL="postgres://postgres:postgres@localhost:5432/<project-name>"
```

## 3. Folder Structure
Expand Down Expand Up @@ -51,6 +51,10 @@ DATABASE_URL="postgres://postgres:postgres@localhost:5432/database-name"
}
]
},
{
id: 'docker-compose',
name: 'docker-compose.yml'
},
{
id: 'drizzle-config',
name: 'drizzle.config.ts'
Expand Down Expand Up @@ -94,7 +98,32 @@ export default {
} satisfies Config
```

## 4. Apply Migrations
```yml title='docker-compose.yml'
version: '3'

services:
db:
image: postgres:16-alpine
container_name: <project-name>_postgres
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=<project-name>
```
<Callout title='Note'>
Remember to replace `<project-name>` with the name of your project.
</Callout>

## 4. Start Database

```bash
docker compose up -d
```

## 5. Apply Migrations

```bash
pnpm db:generate
Expand Down

0 comments on commit 40ab04f

Please sign in to comment.