/* Navicat Premium Dump SQL Source Server : root@localhost Source Server Type : MySQL Source Server Version : 80045 (8.0.45) Source Host : 127.0.0.1:3306 Source Schema : bookmgr Target Server Type : MySQL Target Server Version : 80045 (8.0.45) File Encoding : 65001 Date: 24/05/2026 01:05:44 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for book -- ---------------------------- DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `author` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `stock` int DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Table structure for borrow_record -- ---------------------------- DROP TABLE IF EXISTS `borrow_record`; CREATE TABLE `borrow_record` ( `id` bigint NOT NULL AUTO_INCREMENT, `user_id` bigint DEFAULT NULL, `book_id` bigint DEFAULT NULL, `borrow_time` datetime DEFAULT NULL, `return_time` datetime DEFAULT NULL, `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` bigint NOT NULL AUTO_INCREMENT, `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `role` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'USER', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SET FOREIGN_KEY_CHECKS = 1;