Add Prisma seed script with deterministic test data for local development #93
Reference in New Issue
Block a user
Delete Branch "copilot/add-local-seed-data"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Local testing required manual API calls to populate users, content, bindings, and verifications. Front-end developers needed on-chain writes for each session.
Changes
Core Implementation
prisma/seed.ts: Generates 5 test creators (Hardhat default mnemonic), 5 content entries, 10 platform bindings (YouTube, TikTok, GitHub, Instagram, Discord, LinkedIn), 3 verificationspackage.json: Addeddb:seedanddb:resetscripts with Prisma seed configtsconfig.json: Include prisma directory for TypeScript compilationDocumentation
prisma/SEED_DATA.md: Test account addresses, platform binding IDs, usage examples, security warningsREADME.md,docs/CONTRIBUTOR_ONBOARDING.md,.env.examplewith seed instructionsTesting
test/seed.test.ts: 15 tests validating script structure, configuration, and seeded data integrityInfrastructure
docker-compose.yml: Exposed PostgreSQL port 5432 for local accessUsage
Test accounts use public mnemonic
"test test test test test test test test test test test junk"(Hardhat defaults). All addresses are publicly known - never use in production.Example Test Data
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Pull Request Overview
This PR adds database seeding functionality to populate the local development database with deterministic test data. The seed script creates test users, content entries, platform bindings, and verification records to streamline local development and testing workflows.
Key changes:
prisma/seed.ts) that generates 5 test users, 5 content entries, 10 platform bindings, and 3 verification recordstest/seed.test.ts) to verify seed script structure and validate seeded dataReviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@@ -93,2 +91,4 @@ports:- "5432:5432"volumes:- db_data:/var/lib/postgresql/dataExposing the database port (5432) to the host makes the database accessible from outside the Docker network, which could be a security risk in production environments. Consider documenting this change as development-only or using environment-specific Docker Compose files (e.g., docker-compose.override.yml for development).
@@ -0,0 +95,4 @@it("should have deterministic user addresses", async () => {// Check for the first test wallet address (from the standard test mnemonic)const expectedAddress = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266";The expected address uses lowercase letters in the test (line 98), but the seed script stores addresses in lowercase (line 64 of seed.ts uses
.toLowerCase()). The hardcoded address here has mixed case, which will cause the test to fail. Change to:const expectedAddress = \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\";(all lowercase after 0x).