From 07a563de3b85a54d117057c58e635317d766f8f5 Mon Sep 17 00:00:00 2001 From: printempw Date: Tue, 5 Apr 2016 14:46:47 +0800 Subject: [PATCH] update sql --- setup/tables.sql | 4 ++-- setup/update_scripts/update-from-2.4.1-to-2.4.2.php | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/setup/tables.sql b/setup/tables.sql index b9cd4b94..9cad7c72 100644 --- a/setup/tables.sql +++ b/setup/tables.sql @@ -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; diff --git a/setup/update_scripts/update-from-2.4.1-to-2.4.2.php b/setup/update_scripts/update-from-2.4.1-to-2.4.2.php index 0ba339bb..b34a2ecb 100644 --- a/setup/update_scripts/update-from-2.4.1-to-2.4.2.php +++ b/setup/update_scripts/update-from-2.4.1-to-2.4.2.php @@ -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);