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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,9 @@ If you are not a Knight Hacks dev team member, you can still contribute to Forge
23
23
24
24
Install Docker Desktop if you don't already have it.
25
25
26
-
To create a Postgres database locally with docker, you can run `docker compose up`. You will then need to push the schema to the database by running `pnpm db:push`.
26
+
To create a Postgres database locally with Docker, run `docker compose up`. Then apply the committed schema migrations by running `pnpm db:migrate`.
27
+
28
+
If you change any schema files in `packages/db/src/schemas`, generate and commit a migration with `pnpm db:generate`.
27
29
28
30
To stop the Postgres container, run `docker compose stop`. To completely reset your database, run `docker compose down --volumes`.
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,9 +78,11 @@ Database layer using Drizzle ORM with PostgreSQL.
78
78
79
79
- Contains all database schemas
80
80
- Exports the database client
81
-
- Includes migration scripts
81
+
- Includes committed SQL migrations and migration helper scripts
82
82
- Located in `packages/db/src/schemas/`
83
83
84
+
Local development applies schema changes with `pnpm db:migrate`. Schema edits should be followed by `pnpm db:generate`, and the generated files in `packages/db/drizzle/` are part of the reviewed source of truth.
85
+
84
86
### `@forge/auth`
85
87
86
88
Authentication setup using Better Auth with Discord OAuth.
Copy file name to clipboardExpand all lines: docs/GETTING-STARTED.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,12 +75,20 @@ docker compose up
75
75
76
76
> IMPORTANT!
77
77
78
-
You must push the database schema to your local database before running the project. This is a common source of errors for new contributors. The most common error for this will be a "Failed to get current session" error on any page within Blade.
78
+
You must apply the committed migrations to your local database before running the project. This is a common source of errors for new contributors. The most common symptom is a "Failed to get current session" error on Blade pages.
79
79
80
80
```bash
81
-
pnpm db:push
81
+
pnpm db:migrate
82
82
```
83
83
84
+
When you change files in `packages/db/src/schemas`, generate a new migration and commit it:
85
+
86
+
```bash
87
+
pnpm db:generate
88
+
```
89
+
90
+
Pull requests with schema changes are expected to include the generated files in `packages/db/drizzle/`. CI verifies that migrations are committed, that they apply on a fresh database, and that they can upgrade a prod-like sanitized dataset.
91
+
84
92
**Optional:** View the database contents with Drizzle Studio:
85
93
86
94
```bash
@@ -119,7 +127,7 @@ After running this, you'll have full superadmin permissions and can manage other
119
127
120
128
### 6. (Optional) Populate Test Data from Production
121
129
122
-
**Dev Team Members Only:** If you have access to the shared MinIO instance, you can pull a sanitized copy of production data to test with realistic data locally.
130
+
**Dev Team Members Only:** If you have access to the shared MinIO instance, you can pull a sanitized copy of production data to test with realistic data locally. This restores data into the database currently pointed to by `DATABASE_URL`, so make sure you have already run `pnpm db:migrate` first.
123
131
124
132
```bash
125
133
pnpm db:pull
@@ -191,11 +199,13 @@ Look for issues labeled [`Onboarding`](https://github.com/KnightHacks/forge/labe
191
199
3. Test your changes locally
192
200
4. Run checks before submitting:
193
201
```bash
202
+
pnpm db:migrate
194
203
pnpm format
195
204
pnpm lint
196
205
pnpm typecheck
197
206
pnpm build
198
207
```
208
+
If you changed any schema files, also run `pnpm db:generate` and commit the generated migration files.
199
209
5. Commit your changes (use lowercase, descriptive commit messages)
0 commit comments