Skip to content

Commit

Permalink
Merge pull request #9 from samchon/features/implicit
Browse files Browse the repository at this point in the history
Complement #6 - do not draw implicit table when recursive relationship.
  • Loading branch information
samchon authored Oct 25, 2023
2 parents 481cd8b + c152d26 commit 2b96499
Show file tree
Hide file tree
Showing 7 changed files with 609 additions and 59 deletions.
38 changes: 0 additions & 38 deletions ERD.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ erDiagram
String attachment_file_id FK
Int sequence
}
"_bbs_article_commentsTobbs_article_comments" {
String A FK
String B FK
}
"bbs_article_snapshots" }|--|| "bbs_articles" : article
"bbs_article_snapshot_files" }|--|| "bbs_article_snapshots" : snapshot
"bbs_article_snapshot_files" }|--|| "attachment_files" : file
Expand All @@ -72,8 +68,6 @@ erDiagram
"bbs_article_comment_snapshots" }|--|| "bbs_article_comments" : comment
"bbs_article_comment_snapshot_files" }|--|| "bbs_article_comment_snapshots" : snapshot
"bbs_article_comment_snapshot_files" }|--|| "attachment_files" : file
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
```

### `attachment_files`
Expand Down Expand Up @@ -234,13 +228,6 @@ relationship between [bbs_article_comment_snapshots](#bbs_article_comment_snapsh
>
> Sequence order of the attached file in the belonged snapshot.
### `_bbs_article_commentsTobbs_article_comments`
Pair relationship table between [bbs_article_comments](#bbs_article_comments) and [bbs_article_comments](#bbs_article_comments)

**Properties**
- `A`:
- `B`:


## Systematic
```mermaid
Expand Down Expand Up @@ -271,10 +258,6 @@ erDiagram
DateTime updated_at
DateTime deleted_at "nullable"
}
"_shopping_channel_categoriesToshopping_channel_categories" {
String A FK
String B FK
}
"shopping_sales" {
String id PK
String shopping_section_id FK
Expand Down Expand Up @@ -302,8 +285,6 @@ erDiagram
}
"shopping_channel_categories" }|--|| "shopping_channels" : channel
"shopping_channel_categories" }o--o| "shopping_channel_categories" : parent
"_shopping_channel_categoriesToshopping_channel_categories" }|--|| "shopping_channel_categories" : shopping_channel_categories
"_shopping_channel_categoriesToshopping_channel_categories" }|--|| "shopping_channel_categories" : shopping_channel_categories
"shopping_sales" }|--|| "shopping_sections" : section
"shopping_sale_snapshots" }|--|| "shopping_sales" : sale
"shopping_sale_snapshot_channels" }|--|| "shopping_sale_snapshots" : snapshot
Expand Down Expand Up @@ -400,13 +381,6 @@ just use only one. This concept is designed to be expandable in the future.
- `updated_at`: Update time of record.
- `deleted_at`: Deletion time of record.

### `_shopping_channel_categoriesToshopping_channel_categories`
Pair relationship table between [shopping_channel_categories](#shopping_channel_categories) and [shopping_channel_categories](#shopping_channel_categories)

**Properties**
- `A`:
- `B`:


## Actors
```mermaid
Expand Down Expand Up @@ -828,10 +802,6 @@ erDiagram
DateTime created_at
DateTime deleted_at "nullable"
}
"_shopping_channel_categoriesToshopping_channel_categories" {
String A FK
String B FK
}
"shopping_sales" }|--|| "shopping_sections" : section
"shopping_sales" }|--|| "shopping_sellers" : seller
"shopping_sale_snapshots" }|--|| "shopping_sales" : sale
Expand All @@ -848,8 +818,6 @@ erDiagram
"shopping_sale_snapshot_unit_stock_choices" }|--|| "shopping_sale_snapshot_unit_option_candidates" : candidate
"shopping_channel_categories" }|--|| "shopping_channels" : channel
"shopping_channel_categories" }o--o| "shopping_channel_categories" : parent
"_shopping_channel_categoriesToshopping_channel_categories" }|--|| "shopping_channel_categories" : shopping_channel_categories
"_shopping_channel_categoriesToshopping_channel_categories" }|--|| "shopping_channel_categories" : shopping_channel_categories
```

### `shopping_sales`
Expand Down Expand Up @@ -2331,10 +2299,6 @@ erDiagram
String shopping_sale_id FK
DateTime created_at
}
"_bbs_article_commentsTobbs_article_comments" {
String A FK
String B FK
}
"shopping_sale_snapshot_inquiries" ||--|| "bbs_articles" : base
"shopping_sale_snapshot_inquiries" }|--|| "shopping_sale_snapshots" : snapshot
"shopping_sale_snapshot_questions" |o--|| "shopping_sale_snapshot_inquiries" : base
Expand All @@ -2346,8 +2310,6 @@ erDiagram
"bbs_article_snapshots" }|--|| "bbs_articles" : article
"bbs_article_comments" }|--|| "bbs_articles" : article
"bbs_article_comments" }o--o| "bbs_article_comments" : parent
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
```

### `shopping_sale_snapshot_inquiries`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-markdown",
"version": "1.0.3",
"version": "1.0.4",
"description": "Prisma Markdown documents generator including ERD diagrams and comment descriptions",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ model bbs_article_comment_snapshots {
comment bbs_article_comments @relation(fields: [bbs_article_comment_id], references: [id], onDelete: Cascade)
/// List of wrappers of attachment files.
files bbs_article_comment_snapshot_files[]
to_files bbs_article_comment_snapshot_files[]
@@index([bbs_article_comment_id, created_at])
}
Expand Down Expand Up @@ -3488,27 +3488,27 @@ model shopping_sale_snapshot_inquiry_comments {
customer shopping_customers? @relation(fields: [shopping_customer_id], references: [id], onDelete: Cascade)
}

/// @summary Table for caching.
/// Table for caching.
///
/// @author Samchon
model mv_cache_times {
//----
// COLUMNS
//----
/// @summary Primary Key.
/// Primary Key.
///
/// @Format uuid
id String @id @db.Uuid
/// @summary Target schema.
/// Target schema.
schema String @db.VarChar
/// @summary Target table.
/// Target table.
///
/// Database table name.
table String @db.VarChar
/// @summary Identifier of target record.
/// Identifier of target record.
///
/// Even when key type is not string, it must be converted to the string value.
key String @db.VarChar
Expand Down
6 changes: 5 additions & 1 deletion src/writers/MarkdownWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ export namespace MarkdownWriter {
field.isList &&
field.type === model.name,
);
if (opposite === undefined || oppositeField === undefined)
if (
opposite === undefined ||
oppositeField === undefined ||
model === opposite
)
continue;

const relations: DMMF.Model[] = [model, opposite].sort((x, y) =>
Expand Down
13 changes: 0 additions & 13 deletions test/implicit.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ erDiagram
String A FK
String B FK
}
"_bbs_article_commentsTobbs_article_comments" {
String A FK
String B FK
}
"bbs_article_snapshots" }|--|| "bbs_articles" : article
"bbs_article_comments" }|--|| "bbs_articles" : article
"bbs_article_comments" }o--o| "bbs_article_comments" : parent
Expand All @@ -60,8 +56,6 @@ erDiagram
"_attachment_filesTobbs_article_snapshots" }|--|| "bbs_article_snapshots" : bbs_article_snapshots
"_attachment_filesTobbs_article_comment_snapshots" }|--|| "attachment_files" : attachment_files
"_attachment_filesTobbs_article_comment_snapshots" }|--|| "bbs_article_comment_snapshots" : bbs_article_comment_snapshots
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
"_bbs_article_commentsTobbs_article_comments" }|--|| "bbs_article_comments" : bbs_article_comments
```

### `bbs_articles`
Expand Down Expand Up @@ -199,13 +193,6 @@ Pair relationship table between [attachment_files](#attachment_files) and [bbs_a
### `_attachment_filesTobbs_article_comment_snapshots`
Pair relationship table between [attachment_files](#attachment_files) and [bbs_article_comment_snapshots](#bbs_article_comment_snapshots)

**Properties**
- `A`:
- `B`:

### `_bbs_article_commentsTobbs_article_comments`
Pair relationship table between [bbs_article_comments](#bbs_article_comments) and [bbs_article_comments](#bbs_article_comments)

**Properties**
- `A`:
- `B`:
Loading

0 comments on commit 2b96499

Please sign in to comment.