Open jkliuh2 opened 6 months ago
CREATE TABLE `chat_message` (
`id` int NOT NULL AUTO_INCREMENT primary key
, `chatId` int not null
, `sellerId` int
, `buyerId` int
, `content` varchar(256) not null
, `createdAt` timestamp DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
sellerId, buyerId는 모두 user
테이블의 pk 참조값.
실제 컬럼에서는 둘 중 하나의 값만 채워지고 다른 하나는 NULL 상태가 된다.
채팅 메시지를 입력한 쪽이 데이터가 채워지는 user를 나타낸다.
거래제안 채팅방의 DB 생성.