Skip to content

Commit aba62ff

Browse files
committed
Update db.sql
1 parent 39f71ae commit aba62ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sql/db.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CREATE TABLE `changes` (
1313
PRIMARY KEY (`code`, `new_code`, `time`) USING BTREE,
1414
INDEX `desc_id`(`desc_id` ASC) USING BTREE,
1515
CONSTRAINT `changes_ibfk_1` FOREIGN KEY (`desc_id`) REFERENCES `descriptions` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
16-
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs;
16+
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs ROW_FORMAT = DYNAMIC;
1717

1818
-- ----------------------------
1919
-- Table structure for codes
@@ -25,7 +25,7 @@ CREATE TABLE `codes` (
2525
`start` int NOT NULL,
2626
`end` int NULL DEFAULT NULL,
2727
PRIMARY KEY (`code`, `start`) USING BTREE
28-
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs;
28+
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs ROW_FORMAT = DYNAMIC;
2929

3030
-- ----------------------------
3131
-- Table structure for descriptions
@@ -35,12 +35,12 @@ CREATE TABLE `descriptions` (
3535
`id` int NOT NULL AUTO_INCREMENT,
3636
`text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_zh_0900_as_cs NOT NULL,
3737
PRIMARY KEY (`id`) USING BTREE
38-
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs;
38+
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_zh_0900_as_cs ROW_FORMAT = DYNAMIC;
3939

4040
-- ----------------------------
4141
-- View structure for changes_ext
4242
-- ----------------------------
4343
DROP VIEW IF EXISTS `changes_ext`;
44-
CREATE ALGORITHM = MERGE SQL SECURITY DEFINER VIEW `changes_ext` AS select `c`.`code` AS `code`,`p`.`name` AS `name`,`p`.`start` AS `start`,`c`.`new_code` AS `new_code`,`s`.`name` AS `new_name`,`s`.`start` AS `new_start`,`c`.`time` AS `time`,`c`.`desc_id` AS `desc_id` from ((`changes` `c` join `codes` `p` on(((`p`.`code` = `c`.`code`) and ((`c`.`time` - 1) >= `p`.`start`) and ((`p`.`end` is null) or ((`c`.`time` - 1) < `p`.`end`))))) join `codes` `s` on(((`s`.`code` = `c`.`new_code`) and (`c`.`time` >= `s`.`start`) and ((`s`.`end` is null) or (`c`.`time` < `s`.`end`)))));
44+
CREATE ALGORITHM = MERGE SQL SECURITY DEFINER VIEW `changes_ext` AS select `c`.`code` AS `code`,`a`.`name` AS `name`,`a`.`start` AS `start`,`c`.`new_code` AS `new_code`,`b`.`name` AS `new_name`,`b`.`start` AS `new_start`,`c`.`time` AS `time`,`c`.`desc_id` AS `desc_id`,`d`.`text` AS `desc_text` from (((`changes` `c` join `codes` `a` on(((`a`.`code` = `c`.`code`) and (`a`.`start` < `c`.`time`) and ((`a`.`end` is null) or (`a`.`end` >= `c`.`time`))))) join `codes` `b` on(((`b`.`code` = `c`.`new_code`) and (`b`.`start` <= `c`.`time`) and ((`b`.`end` is null) or (`b`.`end` > `c`.`time`))))) left join `descriptions` `d` on((`d`.`id` = `c`.`desc_id`))) order by `c`.`time` desc,`c`.`code`,`c`.`new_code`;
4545

4646
SET FOREIGN_KEY_CHECKS = 1;

0 commit comments

Comments
 (0)