-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |