You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,43 +96,42 @@ From the `CODEPOD_ROOT/compose/dev` folder, run:
96
96
docker compose up -d
97
97
```
98
98
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).
101
100
102
101
Wait a few minutes for the package installation and compilation. Once the `ui` and
103
102
`api` containers are ready, go to `http://localhost:80` to see the app.
104
103
105
104
-`http://localhost:80/graphql`: Apollo GraphQL explorer for the backend APIs
106
105
-`http://prisma.127.0.0.1.sslip.io`: Prisma Studio for viewing and debugging the database.
107
106
108
-
### Initializing the database
107
+
### Initializing database tables
109
108
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):
111
110
112
111
```bash
113
112
docker exec -it dev-api-1 /bin/bash
114
113
```
115
114
116
115
and then **from the shell of the API container** run:
117
116
118
-
```bash
119
-
npx prisma migrate deploy
120
-
```
121
117
122
-
### Updating the database
123
118
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,
>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
136
135
137
136
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
138
137
@@ -141,7 +140,7 @@ If you are a developer who wants to change the database schema for adding a feat
141
140
```
142
141
143
142
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.
0 commit comments