Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-seeding should not append the data in master table #460

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

KulkarniShashank
Copy link
Contributor

What

  • Prevent Appending Data in Prisma When Re-seeding for Master Record

Why

  • When re-seeding data for a master record in Prisma, it is essential to ensure that the process does not append duplicate data. Appending data can lead to inconsistencies, redundancy, and potential issues in the application's functionality.

How

To address this issue, follow these steps:

  • Identification of Master Record:

Identify the master record for which re-seeding is being performed. This is typically a record that serves as a primary reference point in the database.

  • Data Check:

Before re-seeding, implement a check to verify if the data already exists for the identified master record. This can be done by querying the database using Prisma to check for existing data associated with the master record.

  • Conditional Seeding:

Modify the re-seeding process to conditionally insert data only if it does not already exist. This can be achieved by using Prisma's findUnique or findFirst functions to check for the presence of the master record before attempting to insert new data.

Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@KulkarniShashank KulkarniShashank linked an issue Jan 23, 2024 that may be closed by this pull request
@ankita-p17 ankita-p17 merged commit d2e73af into develop Feb 2, 2024
2 checks passed
@KulkarniShashank KulkarniShashank deleted the 458-re-seeding-should-not-append-the-data branch March 8, 2024 14:49
KulkarniShashank added a commit that referenced this pull request Sep 11, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
KulkarniShashank added a commit that referenced this pull request Sep 11, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
KulkarniShashank added a commit that referenced this pull request Sep 11, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
KulkarniShashank added a commit that referenced this pull request Sep 11, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
KulkarniShashank added a commit that referenced this pull request Sep 12, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
KulkarniShashank added a commit that referenced this pull request Sep 12, 2024
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
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.

refactor: re-seeding should not append the data
3 participants