You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.3 KiB
MySQL
71 lines
2.3 KiB
MySQL
9 months ago
|
/*
|
||
|
Navicat Premium Data Transfer
|
||
|
|
||
|
Source Server : root
|
||
|
Source Server Type : MySQL
|
||
|
Source Server Version : 80035
|
||
|
Source Host : localhost:3306
|
||
|
Source Schema : rfid
|
||
|
|
||
|
Target Server Type : MySQL
|
||
|
Target Server Version : 80035
|
||
|
File Encoding : 65001
|
||
|
|
||
|
Date: 15/01/2024 15:26:43
|
||
|
*/
|
||
|
|
||
|
SET NAMES utf8mb4;
|
||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for rfid_content
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `rfid_content`;
|
||
|
CREATE TABLE `rfid_content` (
|
||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||
|
`readkind` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||
|
`deviceno` int NULL DEFAULT NULL,
|
||
|
`content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||
|
`logtime` datetime NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 133 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for rfid_heartbeat
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `rfid_heartbeat`;
|
||
|
CREATE TABLE `rfid_heartbeat` (
|
||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||
|
`deviceno` int NULL DEFAULT NULL,
|
||
|
`beattime` datetime NULL DEFAULT NULL,
|
||
|
`timespan` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for rfid_state
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `rfid_state`;
|
||
|
CREATE TABLE `rfid_state` (
|
||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||
|
`deviceno` int NULL DEFAULT NULL,
|
||
|
`devicestate` bit(1) NULL DEFAULT NULL,
|
||
|
`logtime` datetime NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Event structure for 90daysdata
|
||
|
-- ----------------------------
|
||
|
DROP EVENT IF EXISTS `90daysdata`;
|
||
|
delimiter ;;
|
||
|
CREATE EVENT `90daysdata`
|
||
|
ON SCHEDULE
|
||
|
EVERY '1' DAY STARTS '2024-01-15 15:13:51'
|
||
|
ON COMPLETION PRESERVE
|
||
|
DO DELETE FROM rfid_content WHERE logtime < DATE_SUB(NOW(),INTERVAL 90 DAY)
|
||
|
;;
|
||
|
delimiter ;
|
||
|
|
||
|
SET FOREIGN_KEY_CHECKS = 1;
|