Skip to content

Instantly share code, notes, and snippets.

@lucemia
Created April 2, 2014 14:05
Show Gist options
  • Select an option

  • Save lucemia/9934856 to your computer and use it in GitHub Desktop.

Select an option

Save lucemia/9934856 to your computer and use it in GitHub Desktop.
// 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