Skip to content

[Backend] backend/prisma/seed.ts has no idempotency guard, so re-running it against a populated dev DB creates duplicate rows or throws unique-constraint errors #1094

Description

@grantfox-oss

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

backend/prisma/seed.ts presumably inserts demo users/streams for local development. If it uses create() rather than upsert(), running npx prisma db seed a second time against an already-seeded database will either duplicate rows (if IDs aren't unique-constrained) or crash with a constraint violation, making the seed script unsafe to re-run, which is a common local-dev workflow.

Acceptance criteria

  • Audit seed.ts for create() calls that should be upsert()
  • Make the script safe to run repeatedly against the same database
  • Note the idempotency guarantee in backend/README.md

Files to touch

  • backend/prisma/seed.ts
  • backend/README.md

Out of scope

  • Changing the seed data content
  • Adding a db reset wrapper script

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programThird CampaignCampaign: Third CampaignbackendBackend related tasksbugSomething isn't workingdatabasePostgreSQL / Prisma

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions