Skip to content

Implement Prisma database layer#2

Open
Spbd1 wants to merge 1 commit into
codex/create-monorepo-foundation-for-parcel-societyfrom
codex/implement-database-layer-with-prisma
Open

Implement Prisma database layer#2
Spbd1 wants to merge 1 commit into
codex/create-monorepo-foundation-for-parcel-societyfrom
codex/implement-database-layer-with-prisma

Conversation

@Spbd1

@Spbd1 Spbd1 commented May 8, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Introduce a first-class, type-safe PostgreSQL data layer using Prisma to persist Parcel Society domain objects and relationships.
  • Model the full experimental domain (servers, seasons, rounds, players, parcels, decisions, contracts, events, treasury, audit, checks, exports) to support gameplay, admin, and export workflows.
  • Provide an idempotent seed for development demos and document migration and client generation steps for local development.

Description

  • Add a complete Prisma schema at packages/db/prisma/schema.prisma defining enums, models, relations, indexes, and uniqueness constraints for the requested core entities and types.
  • Add a reusable Prisma client singleton to packages/db/src/client.ts with development hot-reload protection and re-export Prisma types/enums from packages/db/src/index.ts.
  • Replace the placeholder seed with packages/db/scripts/seed.ts, which idempotently creates one super-admin user/admin profile and four demo servers covering the 2x2 treatment design (low/high inequality × stable/uncertain institutions).
  • Update README.md with migration, client generation, and seeding instructions (pnpm db:migrate, pnpm db:generate, pnpm seed) and a short Docker example for starting PostgreSQL.

Testing

  • Ran git diff --check to validate whitespace and basic diff checks and found no issues.
  • Attempted pnpm --filter @parcel-society/db db:generate to generate the Prisma client, but it could not run because the prisma binary and node_modules are not available in this environment (client generation is environment-dependent).
  • Attempted pnpm install to install dev dependencies locally, but it failed due to npm registry access returning 403 Forbidden, so automated schema migration/generation and package-level tests could not be executed here.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant