From e2bae955d3349652e3562755273026068e4e3b25 Mon Sep 17 00:00:00 2001 From: Masahiro Nagano Date: Tue, 27 Aug 2019 10:14:21 +0900 Subject: [PATCH] after.sql --- webapp/sql/after.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 webapp/sql/after.sql diff --git a/webapp/sql/after.sql b/webapp/sql/after.sql new file mode 100644 index 000000000..1226e4152 --- /dev/null +++ b/webapp/sql/after.sql @@ -0,0 +1,9 @@ +-- mysql> alter table items add root_category_id int unsigned NOT NULL after category_id; +-- Query OK, 0 rows affected (1.60 sec) +-- Records: 0 Duplicates: 0 Warnings: 0 +-- mysql> update items i join categories c on i.category_id=c.id set i.root_category_id = c.parent_id; +-- Query OK, 50162 rows affected (0.44 sec) +-- Rows matched: 50162 Changed: 50162 Warnings: 0 +alter table items add root_category_id int unsigned NOT NULL after category_id; +alter table items add index idx_root_category(root_category_id,created_at); +update items i join categories c on i.category_id=c.id set i.root_category_id = c.parent_id;