Skip to content

Instantly share code, notes, and snippets.

@appkr
Last active August 6, 2024 18:03
Show Gist options
  • Save appkr/48e51c1a717ac0ddf99b40ffba581247 to your computer and use it in GitHub Desktop.
Save appkr/48e51c1a717ac0ddf99b40ffba581247 to your computer and use it in GitHub Desktop.
ERD in plantuml

entity entity
1 -
0 or 1 -o|
one and only 1 -||
many -{
0 or many -o{
1 or many -|{
@startuml
entity member {
*member_id: bigint(20)
name: varchar(40)
city: varchar(40)
street: varchar(100)
zipcode: varchar(5)
}
'order 는 예약어
entity orders {
*order_id: bigint(20)
member_id: bigint(20)
placed_at: timestamp(3)
status: tinyint(4)
}
entity order_item {
*order_item_id: bigint(20)
order_id: bigint(20)
item_id: bigint(20)
sub_total: decimal(10, 2)
quantity: int(10)
}
entity item {
*item_id: bitint(20)
name: varchar(100)
price: decimal(9, 2)
stock: unsigned int(10)
}
entity category {
*category_id: bigint(20)
parent_id: bigint(20)
name: varchar(40)
}
entity category_item {
*category_id: bigint(20)
item_id: bigint(20)
}
entity delivery {
*delivery_id: bigint(20)
city: varchar(40)
street: varchar(100)
zipcode: varchar(5)
status: tinyint(4)
}
member ||--o{ orders
orders ||-o{ order_item
order_item }o-|| item
orders ||--|| delivery
category ||--o{ category_item
category_item }o--|| item
@enduml
@skfms
Copy link

skfms commented May 17, 2024

@startuml

entity member {
*member_id: bigint(20)
name: varchar(40)
city: varchar(40)
street: varchar(100)
zipcode: varchar(5)
}

'order 는 예약어
entity orders {
*order_id: bigint(20)
member_id: bigint(20)
placed_at: timestamp(3)
status: tinyint(4)
}

entity order_item {
*order_item_id: bigint(20)
order_id: bigint(20)
item_id: bigint(20)
sub_total: decimal(10, 2)
quantity: int(10)
}

entity item {
*item_id: bitint(20)
name: varchar(100)
price: decimal(9, 2)
stock: unsigned int(10)
}

entity category {
*category_id: bigint(20)
parent_id: bigint(20)
name: varchar(40)
}

entity category_item {
*category_id: bigint(20)
item_id: bigint(20)
}

entity delivery {
*delivery_id: bigint(20)
city: varchar(40)
street: varchar(100)
zipcode: varchar(5)
status: tinyint(4)
}

member ||--o{ orders
orders ||-o{ order_item
order_item }o-|| item
orders ||--|| delivery
category ||--o{ category_item
category_item }o--|| item

@enduml

@channappadeveloper
Copy link

@startuml

entity Admin {
AdminID : int
Username : string
Password : string
Email : string
Role : string
}

entity Article {
ArticleID : int
Title : string
Content : string
CreatedDate : datetime
ModifiedDate : datetime
Status : string
Category : Category
}

entity Category {
CategoryID : int
Name : string
Description : string
}

entity Comment {
CommentID : int
Article : Article
User : User
CommentText : string
CreatedDate : datetime
}

entity User {
UserID : int
Username : string
Email : string
Password : string
Role : string
}

entity Tag {
TagID : int
Name : string
Description : string
}

Article -- "1" Category
Article "0.." -- "0.." Comment
Comment "1" -- "1" User
User "0.." -- "0.." Comment
Article "0.." -- "0.." Tag
Tag "0.." -- "0.." Article

@enduml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment