Skip to content

Commit e8ff6aa

Browse files
authored
Test database notes (#493)
* add test database to postgres docker docs * clarified that test db must be different than main
1 parent 60107a2 commit e8ff6aa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/pages/docs/database-overview.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ datasource db {
6666
commented-out PostgreSQL `DATABASE_URL` there already. Depending on
6767
your setup, you may need to modify the URL.
6868
3. Update `.env.test.local` as well to use PostgreSQL in your test runs.
69+
(It has to point to different database than your `.env.local`)
6970
4. Delete the `db/migrations` folder
7071
5. Run `blitz prisma migrate dev`. This command will create the database
7172
(if it does not already exist) and tables based on your schema.

app/pages/docs/postgres.mdx

+10
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ services:
5555
ports:
5656
- "5432:5432"
5757

58+
db-test:
59+
image: postgres:latest
60+
env_file: ./.env.test.local
61+
ports:
62+
- 5433:5432
63+
5864
volumes:
5965
data:
6066
```
@@ -71,6 +77,10 @@ POSTGRES_DB=your_database_name
7177
Given these values, update `DATABASE_URL` in `.env.local` to something
7278
similar like
7379
`postgresql://your_user:your_password@localhost:5432/your_database_name`
80+
and in `.env.test.local` to
81+
`postgresql://your_user:your_password@localhost:5433/your_database_name`
82+
83+
Please note that test database is using port `5433` instead of `5432`
7484

7585
3. Modify your `package.json` to start the database before Blitz
7686

0 commit comments

Comments
 (0)