Skip to content

Commit 31d3d45

Browse files
committed
Expand GamePulse seed dataset
1 parent 5cc8298 commit 31d3d45

6 files changed

Lines changed: 575 additions & 183 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ npm run dev
4040
open http://localhost:3000
4141
```
4242

43-
The database seeds automatically on first run with 40+ games, 8 mock critics, community ratings, reviews, awards, and feed items. No configuration needed.
43+
The database seeds automatically on first run with 60+ board games, 14 named critic profiles, 50+ community users, 200+ critic reviews, rich watchlists/wishlists, awards, and release-calendar data. No extra setup is required in local development.
4444

4545
## 📦 Scripts
4646

@@ -143,8 +143,11 @@ GamePulse uses a multi-signal scoring system:
143143
## 💾 Data Notes
144144

145145
- The database lives at `data/gamepulse.db` and is auto-created on first run
146-
- Seed data regenerates when the internal `SEED_VERSION` changes
147-
- All user interactions (ratings, reviews, watchlist, follows, newsletter) persist locally
146+
- The seed catalog currently includes 60+ games, 14 critics, 50+ users, 200+ critic reviews, 100+ community reviews, awards, release-calendar entries, follow relationships, and saved-list activity
147+
- Seeds are deterministic and transactional: the seeding pass clears and rebuilds reference data in a single SQLite transaction, resets autoincrement sequences, and stamps `app_meta.seed_version`
148+
- Edge cases are intentionally included, including one-review games, hidden gems, and divisive titles with strong critic / weak community splits
149+
- In production, automatic reseeds are blocked when reference data already exists unless `GAMEPULSE_ENABLE_PRODUCTION_RESEED=1` is set
150+
- To force a fresh local dataset, run `npm run clean` and then start the app or run `npm run build`
148151
- The current user is a hardcoded mock user ("alex") — see [CONTRIBUTING.md](./CONTRIBUTING.md) for auth notes
149152

150153
## 🐳 Docker

lib/db/connection.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { seedDatabase, SEED_VERSION } from "./seed";
77

88
const DB_DIR = path.join(process.cwd(), "data");
99
const DB_PATH = path.join(DB_DIR, "gamepulse.db");
10+
const PRODUCTION_RESEED_FLAG = "GAMEPULSE_ENABLE_PRODUCTION_RESEED";
1011

1112
declare global {
1213
var __gamePulseDb: Database.Database | undefined;
@@ -31,6 +32,13 @@ function initializeDb(db: Database.Database) {
3132
}
3233

3334
if (meta.value !== SEED_VERSION) {
35+
if (process.env.NODE_ENV === "production" && hasReferenceData && process.env[PRODUCTION_RESEED_FLAG] !== "1") {
36+
console.warn(
37+
`GamePulse seed version mismatch (${meta.value} -> ${SEED_VERSION}). Skipping automatic reseed in production. Set ${PRODUCTION_RESEED_FLAG}=1 to allow it.`,
38+
);
39+
return;
40+
}
41+
3442
seedDatabase(db);
3543
}
3644
}

0 commit comments

Comments
 (0)