mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
[MIRROR] Added comments to the sql schema (#11126)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
314f76c84b
commit
21d1049f1e
@@ -245,6 +245,7 @@ CREATE TABLE IF NOT EXISTS `chatlogs_ckeys` (
|
||||
PRIMARY KEY (`ckey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- Table structure for table `chatlogs_logs`
|
||||
CREATE TABLE IF NOT EXISTS `chatlogs_logs` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`round_id` int(11) NOT NULL DEFAULT -1,
|
||||
@@ -258,6 +259,9 @@ CREATE TABLE IF NOT EXISTS `chatlogs_logs` (
|
||||
CONSTRAINT `chatlogs_ckeys_FK` FOREIGN KEY (`target`) REFERENCES `chatlogs_ckeys` (`ckey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- If you are doing this with the cli you will have to tell it first to use something else as a delimiter instead of ;
|
||||
-- Otherwise the copy/paste will fail. Do not forget to revert the change in the end.
|
||||
DELIMITER //
|
||||
CREATE EVENT `chatlogs_logs_clear_old_logs`
|
||||
ON SCHEDULE
|
||||
EVERY 1 MONTH STARTS '2025-01-01 04:00:00'
|
||||
@@ -269,13 +273,20 @@ CREATE EVENT `chatlogs_logs_clear_old_logs`
|
||||
DELETE FROM chatlogs_logs WHERE created_at < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 3 MONTH)) * 1000;
|
||||
|
||||
END
|
||||
DELIMITER ;
|
||||
-- Also enable the event_scheduler after creating the event
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
-- Table structure for table `chatlogs_rounds`
|
||||
CREATE TABLE `chatlogs_rounds` (
|
||||
`round_id` BIGINT(20) NOT NULL DEFAULT -1,
|
||||
`ckey` VARCHAR(45) NOT NULL COLLATE 'utf8mb4_uca1400_ai_ci',
|
||||
PRIMARY KEY (`round_id`, `ckey`) USING BTREE
|
||||
) ENGINE=InnoDB COLLATE='utf8mb4_uca1400_ai_ci';
|
||||
|
||||
-- If you are doing this with the cli you will have to tell it first to use something else as a delimiter instead of ;
|
||||
-- Otherwise the copy/paste will fail. Do not forget to revert the change in the end.
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE `chatlogs_rounds_insert`(
|
||||
IN `p_round_id` BIGINT,
|
||||
IN `p_ckey` VARCHAR(45)
|
||||
@@ -294,3 +305,4 @@ IF (SELECT COUNT(*) FROM chatlogs_rounds WHERE ckey = p_ckey) > 10 THEN
|
||||
END IF;
|
||||
|
||||
END
|
||||
DELIMITER ;
|
||||
|
||||
Reference in New Issue
Block a user