Open CutTheWire opened 2 months ago
chatbot
A Free Database Designer for Developers and Analysts
erDiagram %% Define the users table %%수정버전 users { integer idx PK "인덱스" varchar userid varchar username varchar email varchar password text access_token text refresh_token datetime created_at "생성날짜" datetime updated_at "수정날짜" } %% Define the characters table characters { integer idx PK "Primary Key" integer users_idx FK "Foreign Key to users" char characters_id "Unique, NOT NULL" varchar name integer creater FK "Foreign Key to users" datetime created_at datetime updated_at } %% Define the chatroom table chatroom { integer idx PK "Primary Key" integer users_idx FK "Foreign Key to users" char character FK "Foreign Key to characters" varchar mongo_chatlog datetime created_at datetime updated_at } %% Define relationships users ||--o| characters : "creates" users ||--o| chatroom : "participates in" characters ||--o| chatroom : "involves"
users (id)
characters (creater)
chatroom (users_idx)
characters (characters_pk)
chatroom (characters_pk)
users
id
INT
AUTO_INCREMENT
PRIMARY KEY
userid
VARCHAR(50)
username
email
VARCHAR(100)
password
VARCHAR(255)
access_token
TEXT
refresh_token
created_at
DATETIME
DEFAULT NOW()
updated_at
ENGINE=InnoDB CHARSET=utf8mb4
characters
characters_id
CHAR(36)
DEFAULT UUID()
creater
FOREIGN KEY
users(id)
name
VARCHAR(30)
chatroom
idx
users_idx
characters(idx)
mongo_chatlog
characters_pk
InnoDB
utf8mb4
데이터베이스:
chatbot
A Free Database Designer for Developers and Analysts
관계도
users (id)
↔characters (creater)
(1:N 관계)users (id)
↔chatroom (users_idx)
(1:N 관계)characters (characters_pk)
↔chatroom (characters_pk)
(1:N 관계)테이블 1:
users
id
INT
AUTO_INCREMENT
,PRIMARY KEY
userid
VARCHAR(50)
username
VARCHAR(50)
email
VARCHAR(100)
password
VARCHAR(255)
access_token
TEXT
refresh_token
TEXT
created_at
DATETIME
DEFAULT NOW()
updated_at
DATETIME
DEFAULT NOW()
ENGINE=InnoDB CHARSET=utf8mb4
를 사용하여 다국어 문자 저장이 가능하며, 트랜잭션을 지원합니다.테이블 2:
characters
characters_id
CHAR(36)
DEFAULT UUID()
,creater
INT
FOREIGN KEY
→users(id)
name
VARCHAR(30)
created_at
DATETIME
DEFAULT NOW()
updated_at
DATETIME
DEFAULT NOW()
creater
필드는users
테이블의id
와 참조 관계입니다.테이블 3:
chatroom
idx
INT
AUTO_INCREMENT
,PRIMARY KEY
users_idx
INT
FOREIGN KEY
→users(id)
characters_id
INT
FOREIGN KEY
→characters(idx)
mongo_chatlog
VARCHAR(100)
created_at
DATETIME
DEFAULT NOW()
updated_at
DATETIME
DEFAULT NOW()
users_idx
필드는users
테이블의id
와 참조 관계입니다.characters_pk
필드는characters
테이블의characters_pk
와 참조 관계입니다.참고
InnoDB
엔진을 사용하여 트랜잭션을 지원합니다.utf8mb4
캐릭터셋을 사용하여 다양한 언어의 문자를 저장할 수 있습니다.예시