Created
April 2, 2014 14:05
-
-
Save lucemia/9934856 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // old table | |
| CREATE TABLE `user_account_old` ( | |
| `user` varchar(255) DEFAULT NULL, | |
| `account` varchar(255) DEFAULT NULL, | |
| `created` timestamp NULL DEFAULT NULL, | |
| `is_add` tinyint(1) DEFAULT NULL, | |
| UNIQUE KEY `user_2` (`user`,`account`), | |
| KEY `user` (`user`), | |
| KEY `account` (`account`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
| // new table | |
| CREATE TABLE `user_account_total` ( | |
| `user` varchar(255) CHARACTER SET ascii DEFAULT NULL, | |
| `account` varchar(255) CHARACTER SET ascii DEFAULT NULL, | |
| `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| `is_add` tinyint(1) DEFAULT NULL, | |
| UNIQUE KEY `user_2` (`user`,`account`), | |
| KEY `account` (`account`) | |
| ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
| // copy | |
| insert into user_account_total(user, account) select user, account from user_account_old |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment