Conversation
Until yesterday, `prisma-markdown` could not distinguish whether 1: N relationships are mandatory or not. In such reason, `prisma-markdown` had drawn 1: N relationship as `||---|{` symbol regardless of the N position is whether mandatory or optional.
To make it clear, I've come with new idea `@minItems 1` tag. If the tag being written on a 1: N relationship accessor, `prisma-markdown` will draw `||---|{` symbol. Otherwise it does not exist, `||---o{` symbol would be drawn instead.
```typescript
model bbs_articles {
id String @id @db.Uuid
created_at DateTime @db.Timestamptz
deleted_at DateTime? @db.Timestamptz
//----
// RELATIONS
//----
/// @minItems 1
snapshots bbs_article_snapshots[]
comments bbs_article_comments[]
}
```
samchon
commented
Nov 8, 2023
Owner
Author
samchon
left a comment
There was a problem hiding this comment.
OK, perfectly expressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until yesterday,
prisma-markdowncould not distinguish whether 1: N relationships are mandatory or not. In such reason,prisma-markdownhad drawn 1: N relationship as||---|{symbol regardless of the N position is whether mandatory or optional.To make it clear, I've come with new idea
@minItems 1tag. If the tag being written on a 1: N relationship accessor,prisma-markdownwill draw||---|{symbol. Otherwise it does not exist,||---o{symbol would be drawn instead.erDiagram "bbs_articles" { String id PK DateTime created_at DateTime deleted_at "nullable" } "bbs_article_snapshots" { String id PK String bbs_article_id FK String format String title String body DateTime created_at } "bbs_article_comments" { String id PK String bbs_article_id FK String parent_id FK "nullable" DateTime created_at DateTime deleted_at "nullable" } "bbs_article_comment_snapshots" { String id PK String bbs_article_comment_id FK String format String body DateTime created_at } "bbs_article_snapshots" }|--|| "bbs_articles" : article "bbs_article_comments" }o--|| "bbs_articles" : article "bbs_article_comments" }o--o| "bbs_article_comments" : parent "bbs_article_comment_snapshots" }|--|| "bbs_article_comments" : comment