Skip to content

Commit

Permalink
refactor: make prisma db-seed idempotent (#402)
Browse files Browse the repository at this point in the history
* refactor: idempotent db-seed

* fix: Prevent duplicate entries for schema mappings

* fix: resolved react version conflict

---------

Co-authored-by: Ashutosh Dhande <[email protected]>
  • Loading branch information
ashutoshdhande and ashutosh-revert authored Dec 15, 2023
1 parent a8555cf commit 67f6eb2
Show file tree
Hide file tree
Showing 10 changed files with 964 additions and 860 deletions.
17 changes: 15 additions & 2 deletions packages/backend/helpers/crm/transform/transformSchemaMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,24 @@ export const transformFieldMappingToModel = async ({
}) => {
logDebug('transformFieldMappingToModel obj:', obj);
const connectionSchema = await prisma.schemas.findFirst({
where: { object: objType, schema_mapping_id: !!tenantSchemaMappingId ? tenantSchemaMappingId : undefined },
where: {
AND: [
{ object: objType },
{ schema_mapping_id: !!tenantSchemaMappingId ? tenantSchemaMappingId : undefined },
],
},
include: { fieldMappings: { where: { source_tp_id: tpId } } },
});
const rootSchema = await prisma.schemas.findFirst({
where: { object: objType, schema_mapping_id: rootSchemaMappingId },
where: {
AND: [
{
object: objType,
},
{ schema_mapping_id: rootSchemaMappingId },
],
},

include: { fieldMappings: { where: { source_tp_id: tpId } } },
});
let transformedObj: Record<string, any> = {};
Expand Down
Loading

1 comment on commit 67f6eb2

@vercel
Copy link

@vercel vercel bot commented on 67f6eb2 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

revert-client – ./

revert-client-git-main-revertdev.vercel.app
revert-client-revertdev.vercel.app
app.revert.dev

Please sign in to comment.