Skip to content

Commit 1540eaf

Browse files
forrestbaoli-xin-yi
authored andcommitted
update DB content in README
1 parent d6d74a6 commit 1540eaf

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Codepod provides the interactive coding experience popularized by Jupyter, but
44
with scalability and production-readiness. Users can still incrementally build
55
up code by trying out a small code snippet each time. But they would not be
6-
overwhelmed by the great number of code snippets as the projects grow.
6+
overwhelmed by the great number of code snippets as the projects grow.k
77

88
<div align="center"><h2>Feel free to
99
visit <a href="https://codepod.io" target="_blank">our homepage</a>,
@@ -96,43 +96,42 @@ From the `CODEPOD_ROOT/compose/dev` folder, run:
9696
docker compose up -d
9797
```
9898

99-
If you this is your first time starting CodePod, you will also need to initialize the database. See [below](#initializing-the-database).
100-
If the database has been updated (you can tell by some errors) since you last pulled the code, you will need to update the database. See [below](#updating-the-database).
99+
If you this is your first time setting up CodePod, or the database schema has been updated (which you can tell from errors), you will also need to [initalize database tables](#initializing-the-database).
101100

102101
Wait a few minutes for the package installation and compilation. Once the `ui` and
103102
`api` containers are ready, go to `http://localhost:80` to see the app.
104103

105104
- `http://localhost:80/graphql`: Apollo GraphQL explorer for the backend APIs
106105
- `http://prisma.127.0.0.1.sslip.io`: Prisma Studio for viewing and debugging the database.
107106

108-
### Initializing the database
107+
### Initializing database tables
109108

110-
To initialize the database, open a shell into the API container (by default called `dev-api-1` but please use `docker ps` to confirm):
109+
To initialize or update the database schema, open a shell into the API container (by default called `dev-api-1` but please use `docker ps` to confirm):
111110

112111
```bash
113112
docker exec -it dev-api-1 /bin/bash
114113
```
115114

116115
and then **from the shell of the API container** run:
117116

118-
```bash
119-
npx prisma migrate deploy
120-
```
121117

122-
### Updating the database
123118

124-
If the schema has been updated since you last pulled the code (you will most likely observe database-related issues), you will need to update the database.
125-
To do that, enter the shell of the API container (by default called `dev-api-1` but please use `docker ps` to confirm) :
126-
127-
```bash
128-
docker exec -it dev-api-1 /bin/bash
129-
```
130-
131-
and then **from the shell of the API container** run
132-
133-
```bash
134-
npx prisma migrate dev
135-
```
119+
> Known issues: if you get the error below during the migration,
120+
>
121+
> ```bash
122+
> EACCES: permission denied, unlink '/app/node_modules/.prisma/client/index.js'
123+
> EACCES: permission denied, unlink '/app/node_modules/.prisma/client/index.js'
124+
> ```
125+
> then please change the ownership of the folder `node_modules` (**from the shell of the API container**):
126+
> ```bash
127+
> chown node:node node_modules/ -R
128+
> ```
129+
> Afterwards, re-run
130+
> ```bash
131+
> npx prisma migrate dev
132+
> ```
133+
134+
### Preparing for database migration
136135
137136
If you are a developer who wants to change the database schema for adding a feature, you can update the schema file `CODEPOD_ROOT/api/prisma/schema.prisma` and then run
138137
@@ -141,7 +140,7 @@ If you are a developer who wants to change the database schema for adding a feat
141140
```
142141
143142
to generate a migration, like [this](./api/prisma/migrations/20221206194247_add_google_login/migration.sql).
144-
The schema change along with this migration need to be checked in (add, commit, and push) to git.
143+
The schema change along with this migration need to be checked in (add, commit, and push) to git.
145144

146145
## Auto-completion & Linting
147146

0 commit comments

Comments
 (0)