diff --git a/src/main/resources/sports.sql b/src/main/resources/sports.sql new file mode 100644 index 0000000000000000000000000000000000000000..812b7f53c5ebaa56467984fb850b71d718d06e53 --- /dev/null +++ b/src/main/resources/sports.sql @@ -0,0 +1,126 @@ +/* + Navicat Premium Data Transfer + + Source Server : sunhaoyu + Source Server Type : MySQL + Source Server Version : 80031 + Source Host : localhost:3306 + Source Schema : sports + + Target Server Type : MySQL + Target Server Version : 80031 + File Encoding : 65001 + + Date: 20/02/2025 14:44:38 +*/ +CREATE DATABASE IF NOT EXISTS sports; +USE sports; +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for images +-- ---------------------------- +DROP TABLE IF EXISTS `images`; +CREATE TABLE `images` ( + `id` int NOT NULL AUTO_INCREMENT, + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `uploaded_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of images +-- ---------------------------- + +-- ---------------------------- +-- Table structure for information +-- ---------------------------- +DROP TABLE IF EXISTS `information`; +CREATE TABLE `information` ( + `id` int NOT NULL AUTO_INCREMENT, + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `role` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'USER', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `username`(`username` ASC) USING BTREE, + UNIQUE INDEX `email`(`email` ASC) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of information +-- ---------------------------- +INSERT INTO `information` VALUES (1, 'shy', 'shy@creditsafe.com', '$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i', 'USER'); +INSERT INTO `information` VALUES (2, 'zyb', 'zyb@creditsafe.com', '$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i', 'USER'); +INSERT INTO `information` VALUES (3, 'xzc', 'xzc@creditsafe.com', '$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i', 'USER'); +INSERT INTO `information` VALUES (4, 'xx', 'xx@creditsafe.com', '$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i', 'USER'); + +-- ---------------------------- +-- Table structure for match_item +-- ---------------------------- +DROP TABLE IF EXISTS `match_item`; +CREATE TABLE `match_item` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `sport` enum('Pools','Darts','TableTennis') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `player_AId` int NULL DEFAULT NULL, + `player_BId` int NULL DEFAULT NULL, + `plan_Time` datetime NOT NULL, + `status` enum('pending','confirmed','completed') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'pending', + `score_a` int NULL DEFAULT 0, + `score_b` int NULL DEFAULT 0, + `confirm_a` tinyint(1) NULL DEFAULT 0, + `confirm_b` tinyint(1) NULL DEFAULT 0, + `winner_id` bigint NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of match_item +-- ---------------------------- +INSERT INTO `match_item` VALUES (29, 'Pools', 1, 2, '2024-11-25 14:30:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (30, 'Darts', 3, 4, '2024-11-26 16:00:00', 'confirmed', 3, 2, 1, 1, 3); +INSERT INTO `match_item` VALUES (31, 'TableTennis', 1, 2, '2024-11-27 18:00:00', 'completed', 21, 18, 1, 1, 2); +INSERT INTO `match_item` VALUES (32, 'Pools', 2, 1, '2024-11-28 20:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (33, 'Darts', 1, 2, '2024-11-29 15:30:00', 'completed', 300, 280, 1, 1, 2); +INSERT INTO `match_item` VALUES (34, 'TableTennis', 1, 2, '2024-11-30 17:00:00', 'confirmed', 3, 1, 1, 1, 1); +INSERT INTO `match_item` VALUES (35, 'TableTennis', NULL, NULL, '2024-12-20 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (36, 'TableTennis', NULL, NULL, '2024-12-21 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (37, 'Pools', NULL, NULL, '2024-12-22 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (38, 'Pools', NULL, NULL, '2024-12-23 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (39, 'Pools', NULL, NULL, '2024-12-24 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (40, 'Darts', NULL, NULL, '2024-12-25 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (41, 'Darts', NULL, NULL, '2024-12-26 17:00:00', 'pending', 0, 0, 0, 0, NULL); +INSERT INTO `match_item` VALUES (42, 'Darts', NULL, NULL, '2024-12-27 17:00:00', 'pending', 0, 0, 0, 0, NULL); + +-- ---------------------------- +-- Table structure for ranking +-- ---------------------------- +DROP TABLE IF EXISTS `ranking`; +CREATE TABLE `ranking` ( + `id` int NOT NULL AUTO_INCREMENT, + `user_id` int NOT NULL, + `sport` enum('Pools','Darts','TableTennis') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `wins` int NULL DEFAULT 0, + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `user_id`(`user_id` ASC, `sport` ASC) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of ranking +-- ---------------------------- +INSERT INTO `ranking` VALUES (25, 1, 'Pools', 0, 'shy'); +INSERT INTO `ranking` VALUES (26, 1, 'Darts', 0, 'shy'); +INSERT INTO `ranking` VALUES (27, 1, 'TableTennis', 0, 'shy'); +INSERT INTO `ranking` VALUES (28, 2, 'Pools', 0, 'zyb'); +INSERT INTO `ranking` VALUES (29, 2, 'Darts', 0, 'zyb'); +INSERT INTO `ranking` VALUES (30, 2, 'TableTennis', 0, 'zyb'); +INSERT INTO `ranking` VALUES (31, 3, 'Pools', 0, 'xzc'); +INSERT INTO `ranking` VALUES (32, 3, 'Darts', 0, 'xzc'); +INSERT INTO `ranking` VALUES (33, 3, 'TableTennis', 0, 'xzc'); +INSERT INTO `ranking` VALUES (34, 4, 'Pools', 0, 'xx'); +INSERT INTO `ranking` VALUES (35, 4, 'Darts', 0, 'xx'); +INSERT INTO `ranking` VALUES (36, 4, 'TableTennis', 0, 'xx'); + +SET FOREIGN_KEY_CHECKS = 1;