update sql

This commit is contained in:
printempw 2016-04-05 14:46:47 +08:00
parent d3c027f619
commit 07a563de3b
2 changed files with 7 additions and 6 deletions

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-04-03 16:22:11
* @Last Modified by: printempw
* @Last Modified time: 2016-04-05 14:08:28
* @Last Modified time: 2016-04-05 14:46:31
*/
CREATE TABLE IF NOT EXISTS `{$prefix}users` (
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `{$prefix}users` (
`hash_steve` varchar(64) DEFAULT '',
`hash_alex` varchar(64) DEFAULT '',
`hash_cape` varchar(64) DEFAULT '',
`last_modified` datetime,
`last_modified` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-04-05 14:33:00
* @Last Modified by: printempw
* @Last Modified time: 2016-04-05 14:41:27
* @Last Modified time: 2016-04-05 14:46:17
*/
if (!defined('BASE_DIR')) exit('请运行 /setup/update.php 来升级');
@ -15,9 +15,10 @@ if (Option::get('current_version') == "2.4.1") {
$db = new Database('options');
$table_name = DB_PREFIX."users";
$sqls[0] = "ALTER TABLE `$table_name` CHANGE `hash_steve` `hash_steve` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
$sqls[1] = "ALTER TABLE `$table_name` CHANGE `hash_alex` `hash_alex` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
$sqls[2] = "ALTER TABLE `$table_name` CHANGE `hash_cape` `hash_cape` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT ''";
$sqls[0] = "ALTER TABLE `$table_name` CHANGE `hash_steve` `hash_steve` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT ''";
$sqls[1] = "ALTER TABLE `$table_name` CHANGE `hash_alex` `hash_alex` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT ''";
$sqls[2] = "ALTER TABLE `$table_name` CHANGE `hash_cape` `hash_cape` VARCHAR(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT ''";
$sqls[2] = "ALTER TABLE `$table_name` CHANGE `last_modified` `last_modified` DATETIME DEFAULT CURRENT_TIMESTAMP";
foreach ($sqls as $sql) {
$db->query($sql);