Skip to content

Comments

feat: add Prisma seed script for database initialization#83

Open
SainiAdi-04 wants to merge 1 commit intoketankauntia:masterfrom
SainiAdi-04:feat/add-prisma-seed
Open

feat: add Prisma seed script for database initialization#83
SainiAdi-04 wants to merge 1 commit intoketankauntia:masterfrom
SainiAdi-04:feat/add-prisma-seed

Conversation

@SainiAdi-04
Copy link

@SainiAdi-04 SainiAdi-04 commented Jan 24, 2026

Summary

This PR adds a Prisma seed script to populate the database with example data for organizations, projects, and waitlist entries. The seed is idempotent and can be safely re-run.
Closes: #77 Prisma seed script

Changes

  • Added prisma/seed.ts with idempotent upsert logic
  • Added support for seeding organizations, projects, and waitlist entries
  • Enabled running seeds via pnpm prisma db seed

Setup Notes

During setup, the following were required:

  • Install tsx to run the TypeScript seed file
  • Use .env instead of .env.local for Prisma
  • Ensure the MongoDB connection string includes a database name

Testing

pnpm install
pnpm prisma generate
pnpm prisma db seed

Checklist

  • One logical change per PR
  • PR description is complete
  • No refactors without prior discussion
  • Follows existing project structure

Summary by CodeRabbit

  • Chores
    • Added automated database seeding capability to support development and testing environments with pre-configured example data
    • Configured TypeScript-based seed script execution for data initialization
    • Added TypeScript execution tool to development dependencies
    • Updated version control configuration to exclude IDE workspace settings from repository tracking

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 24, 2026

@SainiAdi-04 is attempting to deploy a commit to the Ketan's Personal Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Expected 'de' | 'de-DE' | 'de-AT' | 'de-CH' | 'en' | 'en-US' | 'en-AU' | 'en-GB' | 'en-CA' | 'en-NZ' | 'en-ZA' | 'es' | 'es-AR' | 'fr' | 'fr-CA' | 'fr-CH' | 'fr-BE' | 'nl' | 'nl-BE' | 'pt-AO' | 'pt' | 'pt-BR' | 'pt-MZ' | 'pt-PT' | 'ar' | 'ast-ES' | 'ast' | 'be-BY' | 'be' | 'br-FR' | 'br' | 'ca-ES' | 'ca' | 'ca-ES-valencia' | 'ca-ES-balear' | 'da-DK' | 'da' | 'de-DE-x-simple-language' | 'el-GR' | 'el' | 'eo' | 'fa' | 'ga-IE' | 'ga' | 'gl-ES' | 'gl' | 'it' | 'ja-JP' | 'ja' | 'km-KH' | 'km' | 'ko-KR' | 'ko' | 'pl-PL' | 'pl' | 'ro-RO' | 'ro' | 'ru-RU' | 'ru' | 'sk-SK' | 'sk' | 'sl-SI' | 'sl' | 'sv' | 'ta-IN' | 'ta' | 'tl-PH' | 'tl' | 'tr' | 'uk-UA' | 'uk' | 'zh-CN' | 'zh' | 'crh-UA' | 'crh' | 'cs-CZ' | 'cs' | 'nb' | 'no' | 'nl-NL' | 'de-DE-x-simple-language-DE' | 'es-ES' | 'it-IT' | 'fa-IR' | 'sv-SE' | 'de-LU' | 'fr-FR' | 'bg-BG' | 'bg' | 'he-IL' | 'he' | 'hi-IN' | 'hi' | 'vi-VN' | 'vi' | 'th-TH' | 'th' | 'bn-BD' | 'bn', received object at "language"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

This PR establishes Prisma database seeding capability by configuring a seed script in package.json, adding the tsx dependency, and implementing a seed.ts file that idempotently populates an example organization, project, and waitlist entry. Also ignores .vscode/ directory.

Changes

Cohort / File(s) Summary
Version Control
\.gitignore
Adds .vscode/ to excluded paths
Package Configuration
package.json
Adds db:seed npm script pointing to prisma db seed; adds Prisma seed configuration targeting prisma/seed.ts; introduces tsx (^4.21.0) as both development and direct dependency
Database Seeding
prisma/seed.ts
New seed script with idempotent upsert operations for example organization (including metadata, images, social links, stats, technologies, topics, and years), linked example project (with codes, HTML, mentor/contributor references), and waitlist entry; includes proper PrismaClient initialization, logging, error handling, and cleanup

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 With a hop and a skip, the seeds now take flight,
Database gardens growing from code, oh what a sight!
.vscode tucked away, tsx bundled with care,
Organizations sprouting from Prisma's seed layer,
A warren of data, seeded so fair! 🌱✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly describes the main objective: adding a Prisma seed script for database initialization, which is the primary focus of all changes.
Description check ✅ Passed The description covers all required template sections with clear summary, testing instructions, and completed checklist items; minor documentation of setup requirements is present.
Linked Issues check ✅ Passed The pull request successfully implements the objective from issue #77 by providing a configured Prisma seed script that enables npx/pnpm prisma db seed to populate organizations and related data.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the seed script implementation: .gitignore configuration, package.json seed setup, and the seed script file itself; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prisma seed script

1 participant