DROP TABLE IF EXISTS tb_room;
CREATE TABLE tb_room
(
    batch_no VARCHAR(50) PRIMARY KEY,
    item_num INT NOT NULL,
    player_count INT NOT NULL DEFAULT 0,
    create_date DATETIME
);

DROP TABLE IF EXISTS tb_game;
CREATE TABLE tb_game
(
    wechat_id text,
    nickname VARCHAR(50),
    avatar text,
    game_rank INT NOT NULL,
    item_num INT NOT NULL,
    score INT NOT NULL DEFAULT 0,
    create_date DATETIME,
    batch_no VARCHAR(50)
);

DROP TABLE IF EXISTS tb_log;
CREATE TABLE tb_log
(
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    msg TEXT,
    params JSON,
    create_date DATETIME
);

DROP TABLE IF EXISTS tb_manager;
CREATE TABLE tb_manager
(
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(20),
    `password` VARCHAR(20),
    token VARCHAR(36)
);

INSERT INTO tb_manager(username, `password`, token)
VALUES ('admin', '123456', '88236aeb-8d3f-6d56-fdf5-3adca3961dfb');
