56,679
社区成员
发帖
与我相关
我的任务
分享
DROP TABLE IF EXISTS `tab_user_auth`;
CREATE TABLE `tab_user_auth` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'user id',
`user_name` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT 'user name',
`user_password` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT 'password of user',
`account_type` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT 'account type',
`create_time` datetime NOT NULL COMMENT 'create time',
PRIMARY KEY (`id`,`user_name`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `user_name` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DELIMITER $$
USE `aquarius`$$
DROP PROCEDURE IF EXISTS `sp_tab_user_auth_add_test_account`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_tab_user_auth_add_test_account`(IN _account_count INT )
BEGIN
DECLARE account_index_ INT;
SET account_index_=0;
WHILE account_index<_account_count
BEGIN
INSERT INTO `tab_user_auth`(`user_name`, `user_password`, `account_type`, `create_time`) VALUES("test" + CONVERT(account_index, VARCHAR(20)), "123456", 1, NOW());
SET account_index_=account_index_+1;
END
END$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `sp_tab_user_auth_add_test_account`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_tab_user_auth_add_test_account`(IN _account_count INT )
BEGIN
DECLARE account_index_ INT;
SET account_index_=0;
WHILE account_index<_account_count do
INSERT INTO `tab_user_auth`(`user_name`, `user_password`, `account_type`, `create_time`) VALUES("test" + CONCAT(account_index, ''), "123456", 1, NOW());
SET account_index_=account_index_+1;
END while;
END$$
DELIMITER ;