Skip to content

Commit

Permalink
fix incorrect relations
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Mar 17, 2024
1 parent 46a397d commit 73f87dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
12 changes: 4 additions & 8 deletions src/scripts/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,11 @@ async function main() {
},
])
.returning()
console.log(
`[SEED] [assetComments] inserted ${newAssetCommentsReplies.length} rows\n`
)

console.log(
"[SEED] [assetCommentsLikes] Seeding asset comments likes..."
`[SEED] [assetComments] inserted ${newAssetCommentsReplies.length} rows\n`
)

console.log("[SEED] [assetCommentsLikes] Seeding asset comments likes...")
const newAssetCommentsLikes = await db
.insert(assetCommentsLikes)
.values([
Expand All @@ -480,15 +478,13 @@ async function main() {
{
commentId: newAssetCommentsReplies[2].id,
likedById: newUsers[0].id,
}
},
])
.returning()
console.log(
`[SEED] [assetCommentsLikes] inserted ${newAssetCommentsLikes.length} rows\n`
)



console.log("[SEED] [userCollection] Seeding user collections...")
const newUserCollections = await db
.insert(userCollection)
Expand Down
16 changes: 8 additions & 8 deletions src/v2/db/schema/asset/asset-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ export const assetCommentsRelations = relations(assetComments, ({ one }) => ({
}))

export const assetCommentsLikesRelations = relations(
assetComments,
assetCommentsLikes,
({ one }) => ({
asset: one(asset, {
fields: [assetComments.assetId],
references: [asset.id],
relationName: "asset_comments_asset",
comment: one(assetComments, {
fields: [assetCommentsLikes.commentId],
references: [assetComments.id],
relationName: "asset_comments_likes_comment",
}),
commentedBy: one(authUser, {
fields: [assetComments.commentedById],
likedBy: one(authUser, {
fields: [assetCommentsLikes.likedById],
references: [authUser.id],
relationName: "asset_comments_commented_by",
relationName: "asset_comments_likes_liked_by",
}),
})
)

0 comments on commit 73f87dd

Please sign in to comment.