Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Nov 3, 2017
1 parent cf002bb commit fee8bcc
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 78 deletions.
3 changes: 1 addition & 2 deletions install/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<option value="utf8"<?php if (_r('dbCharset') == 'utf8'): ?> selected<?php endif; ?>>utf8</option>
<option value="utf8mb4"<?php if (_r('dbCharset') == 'utf8mb4'): ?> selected<?php endif; ?>>utf8mb4</option>
</select>
<p class="description"><?php _e('请选择一个数据库编码, utf8mb4 编码至少需要 MySQL 5.5.3 版本'); ?></p>
<p class="description"><?php _e('选择 utf8mb4 编码至少需要 MySQL 5.5.3 版本'); ?></p>
</li>

<li>
Expand All @@ -162,5 +162,4 @@
<option value="MyISAM"<?php if (_r('dbEngine') == 'MyISAM'): ?> selected<?php endif; ?>>MyISAM</option>
<option value="InnoDB"<?php if (_r('dbEngine') == 'InnoDB'): ?> selected<?php endif; ?>>InnoDB</option>
</select>
<p class="description"><?php _e('请根据需要选择一种数据库引擎'); ?></p>
</li>
24 changes: 12 additions & 12 deletions install/Mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ CREATE TABLE `typecho_comments` (
`coid` int(10) unsigned NOT NULL auto_increment,
`cid` int(10) unsigned default '0',
`created` int(10) unsigned default '0',
`author` varchar(200) default NULL,
`author` varchar(150) default NULL,
`authorId` int(10) unsigned default '0',
`ownerId` int(10) unsigned default '0',
`mail` varchar(200) default NULL,
`url` varchar(200) default NULL,
`mail` varchar(150) default NULL,
`url` varchar(150) default NULL,
`ip` varchar(64) default NULL,
`agent` varchar(200) default NULL,
`agent` varchar(150) default NULL,
`text` text,
`type` varchar(16) default 'comment',
`status` varchar(16) default 'approved',
Expand All @@ -45,8 +45,8 @@ CREATE TABLE `typecho_comments` (

CREATE TABLE `typecho_contents` (
`cid` int(10) unsigned NOT NULL auto_increment,
`title` varchar(200) default NULL,
`slug` varchar(200) default NULL,
`title` varchar(150) default NULL,
`slug` varchar(150) default NULL,
`created` int(10) unsigned default '0',
`modified` int(10) unsigned default '0',
`text` longtext,
Expand Down Expand Up @@ -74,7 +74,7 @@ CREATE TABLE `typecho_contents` (

CREATE TABLE `typecho_fields` (
`cid` int(10) unsigned NOT NULL,
`name` varchar(200) NOT NULL,
`name` varchar(150) NOT NULL,
`type` varchar(8) default 'str',
`str_value` text,
`int_value` int(10) default '0',
Expand All @@ -92,10 +92,10 @@ CREATE TABLE `typecho_fields` (

CREATE TABLE `typecho_metas` (
`mid` int(10) unsigned NOT NULL auto_increment,
`name` varchar(200) default NULL,
`slug` varchar(200) default NULL,
`name` varchar(150) default NULL,
`slug` varchar(150) default NULL,
`type` varchar(32) NOT NULL,
`description` varchar(200) default NULL,
`description` varchar(150) default NULL,
`count` int(10) unsigned default '0',
`order` int(10) unsigned default '0',
`parent` int(10) unsigned default '0',
Expand Down Expand Up @@ -138,8 +138,8 @@ CREATE TABLE `typecho_users` (
`uid` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) default NULL,
`password` varchar(64) default NULL,
`mail` varchar(200) default NULL,
`url` varchar(200) default NULL,
`mail` varchar(150) default NULL,
`url` varchar(150) default NULL,
`screenName` varchar(32) default NULL,
`created` int(10) unsigned default '0',
`activated` int(10) unsigned default '0',
Expand Down
24 changes: 12 additions & 12 deletions install/Pgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ CREATE SEQUENCE "typecho_comments_seq";
CREATE TABLE "typecho_comments" ( "coid" INT NOT NULL DEFAULT nextval('typecho_comments_seq'),
"cid" INT NULL DEFAULT '0',
"created" INT NULL DEFAULT '0',
"author" VARCHAR(200) NULL DEFAULT NULL,
"author" VARCHAR(150) NULL DEFAULT NULL,
"authorId" INT NULL DEFAULT '0',
"ownerId" INT NULL DEFAULT '0',
"mail" VARCHAR(200) NULL DEFAULT NULL,
"url" VARCHAR(200) NULL DEFAULT NULL,
"mail" VARCHAR(150) NULL DEFAULT NULL,
"url" VARCHAR(150) NULL DEFAULT NULL,
"ip" VARCHAR(64) NULL DEFAULT NULL,
"agent" VARCHAR(200) NULL DEFAULT NULL,
"agent" VARCHAR(150) NULL DEFAULT NULL,
"text" TEXT NULL DEFAULT NULL,
"type" VARCHAR(16) NULL DEFAULT 'comment',
"status" VARCHAR(16) NULL DEFAULT 'approved',
Expand All @@ -31,8 +31,8 @@ CREATE INDEX "typecho_comments_created" ON "typecho_comments" ("created");
CREATE SEQUENCE "typecho_contents_seq";

CREATE TABLE "typecho_contents" ( "cid" INT NOT NULL DEFAULT nextval('typecho_contents_seq'),
"title" VARCHAR(200) NULL DEFAULT NULL,
"slug" VARCHAR(200) NULL DEFAULT NULL,
"title" VARCHAR(150) NULL DEFAULT NULL,
"slug" VARCHAR(150) NULL DEFAULT NULL,
"created" INT NULL DEFAULT '0',
"modified" INT NULL DEFAULT '0',
"text" TEXT NULL DEFAULT NULL,
Expand All @@ -58,7 +58,7 @@ CREATE INDEX "typecho_contents_created" ON "typecho_contents" ("created");
--

CREATE TABLE "typecho_fields" ("cid" INT NOT NULL,
"name" VARCHAR(200) NOT NULL,
"name" VARCHAR(150) NOT NULL,
"type" VARCHAR(8) NULL DEFAULT 'str',
"str_value" TEXT NULL DEFAULT NULL,
"int_value" INT NULL DEFAULT '0',
Expand All @@ -76,10 +76,10 @@ CREATE INDEX "typecho_fields_float_value" ON "typecho_fields" ("float_value");
CREATE SEQUENCE "typecho_metas_seq";

CREATE TABLE "typecho_metas" ( "mid" INT NOT NULL DEFAULT nextval('typecho_metas_seq'),
"name" VARCHAR(200) NULL DEFAULT NULL,
"slug" VARCHAR(200) NULL DEFAULT NULL,
"name" VARCHAR(150) NULL DEFAULT NULL,
"slug" VARCHAR(150) NULL DEFAULT NULL,
"type" VARCHAR(16) NOT NULL DEFAULT '',
"description" VARCHAR(200) NULL DEFAULT NULL,
"description" VARCHAR(150) NULL DEFAULT NULL,
"count" INT NULL DEFAULT '0',
"order" INT NULL DEFAULT '0',
"parent" INT NULL DEFAULT '0',
Expand Down Expand Up @@ -116,8 +116,8 @@ CREATE SEQUENCE "typecho_users_seq";
CREATE TABLE "typecho_users" ( "uid" INT NOT NULL DEFAULT nextval('typecho_users_seq') ,
"name" VARCHAR(32) NULL DEFAULT NULL,
"password" VARCHAR(64) NULL DEFAULT NULL,
"mail" VARCHAR(200) NULL DEFAULT NULL,
"url" VARCHAR(200) NULL DEFAULT NULL,
"mail" VARCHAR(150) NULL DEFAULT NULL,
"url" VARCHAR(150) NULL DEFAULT NULL,
"screenName" VARCHAR(32) NULL DEFAULT NULL,
"created" INT NULL DEFAULT '0',
"activated" INT NULL DEFAULT '0',
Expand Down
26 changes: 13 additions & 13 deletions install/SQLite.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
CREATE TABLE typecho_comments ( "coid" INTEGER NOT NULL PRIMARY KEY,
"cid" int(10) default '0' ,
"created" int(10) default '0' ,
"author" varchar(200) default NULL ,
"author" varchar(150) default NULL ,
"authorId" int(10) default '0' ,
"ownerId" int(10) default '0' ,
"mail" varchar(200) default NULL ,
"url" varchar(200) default NULL ,
"mail" varchar(150) default NULL ,
"url" varchar(150) default NULL ,
"ip" varchar(64) default NULL ,
"agent" varchar(200) default NULL ,
"agent" varchar(150) default NULL ,
"text" text ,
"type" varchar(16) default 'comment' ,
"status" varchar(16) default 'approved' ,
Expand All @@ -17,8 +17,8 @@ CREATE INDEX typecho_comments_cid ON typecho_comments ("cid");
CREATE INDEX typecho_comments_created ON typecho_comments ("created");

CREATE TABLE typecho_contents ( "cid" INTEGER NOT NULL PRIMARY KEY,
"title" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"title" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"created" int(10) default '0' ,
"modified" int(10) default '0' ,
"text" text ,
Expand All @@ -38,7 +38,7 @@ CREATE UNIQUE INDEX typecho_contents_slug ON typecho_contents ("slug");
CREATE INDEX typecho_contents_created ON typecho_contents ("created");

CREATE TABLE "typecho_fields" ("cid" INTEGER NOT NULL,
"name" varchar(200) NOT NULL,
"name" varchar(150) NOT NULL,
"type" varchar(8) default 'str',
"str_value" text,
"int_value" int(10) default '0',
Expand All @@ -50,10 +50,10 @@ CREATE INDEX typecho_fields_int_value ON typecho_fields ("int_value");
CREATE INDEX typecho_fields_float_value ON typecho_fields ("float_value");

CREATE TABLE typecho_metas ( "mid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"name" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"type" varchar(32) NOT NULL ,
"description" varchar(200) default NULL ,
"description" varchar(150) default NULL ,
"count" int(10) default '0' ,
"order" int(10) default '0' ,
"parent" int(10) default '0');
Expand All @@ -72,10 +72,10 @@ CREATE TABLE typecho_relationships ( "cid" int(10) NOT NULL ,
CREATE UNIQUE INDEX typecho_relationships_cid_mid ON typecho_relationships ("cid", "mid");

CREATE TABLE typecho_users ( "uid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(32) default NULL ,
"name" varchar(32) default NULL ,
"password" varchar(64) default NULL ,
"mail" varchar(200) default NULL ,
"url" varchar(200) default NULL ,
"mail" varchar(150) default NULL ,
"url" varchar(150) default NULL ,
"screenName" varchar(32) default NULL ,
"created" int(10) default '0' ,
"activated" int(10) default '0' ,
Expand Down
64 changes: 32 additions & 32 deletions var/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ public static function v0_6r9_4_3($db, $options)
$db->query('CREATE TABLE ' . $prefix . 'users_' . $uuid . ' ( "uid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(32) default NULL ,
"password" varchar(64) default NULL ,
"mail" varchar(200) default NULL ,
"url" varchar(200) default NULL ,
"mail" varchar(150) default NULL ,
"url" varchar(150) default NULL ,
"screenName" varchar(32) default NULL ,
"created" int(10) default \'0\' ,
"activated" int(10) default \'0\' ,
Expand All @@ -227,8 +227,8 @@ public static function v0_6r9_4_3($db, $options)
$db->query('CREATE TABLE ' . $prefix . 'users ( "uid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(32) default NULL ,
"password" varchar(64) default NULL ,
"mail" varchar(200) default NULL ,
"url" varchar(200) default NULL ,
"mail" varchar(150) default NULL ,
"url" varchar(150) default NULL ,
"screenName" varchar(32) default NULL ,
"created" int(10) default \'0\' ,
"activated" int(10) default \'0\' ,
Expand All @@ -250,24 +250,24 @@ public static function v0_6r9_4_3($db, $options)
//do nothing
}

//将slug字段长度增加到200
//将slug字段长度增加到150
try {
switch (true) {
case false !== strpos($adapterName, 'Mysql'):
$db->query("ALTER TABLE `" . $prefix . "contents` MODIFY COLUMN `slug` varchar(200)", Typecho_Db::WRITE);
$db->query("ALTER TABLE `" . $prefix . "metas` MODIFY COLUMN `slug` varchar(200)", Typecho_Db::WRITE);
$db->query("ALTER TABLE `" . $prefix . "contents` MODIFY COLUMN `slug` varchar(150)", Typecho_Db::WRITE);
$db->query("ALTER TABLE `" . $prefix . "metas` MODIFY COLUMN `slug` varchar(150)", Typecho_Db::WRITE);
break;

case false !== strpos($adapterName, 'Pgsql'):
$db->query('ALTER TABLE "' . $prefix . 'contents" ALTER COLUMN "slug" TYPE varchar(200)', Typecho_Db::WRITE);
$db->query('ALTER TABLE "' . $prefix . 'metas" ALTER COLUMN "slug" TYPE varchar(200)', Typecho_Db::WRITE);
$db->query('ALTER TABLE "' . $prefix . 'contents" ALTER COLUMN "slug" TYPE varchar(150)', Typecho_Db::WRITE);
$db->query('ALTER TABLE "' . $prefix . 'metas" ALTER COLUMN "slug" TYPE varchar(150)', Typecho_Db::WRITE);
break;

case false !== strpos($adapterName, 'SQLite'):
$uuid = uniqid();
$db->query('CREATE TABLE ' . $prefix . 'contents' . $uuid . ' ( "cid" INTEGER NOT NULL PRIMARY KEY,
"title" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"title" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"created" int(10) default \'0\' ,
"modified" int(10) default \'0\' ,
"text" text ,
Expand All @@ -284,8 +284,8 @@ public static function v0_6r9_4_3($db, $options)
$db->query('INSERT INTO ' . $prefix . 'contents' . $uuid . ' SELECT * FROM ' . $prefix . 'contents', Typecho_Db::WRITE);
$db->query('DROP TABLE ' . $prefix . 'contents', Typecho_Db::WRITE);
$db->query('CREATE TABLE ' . $prefix . 'contents ( "cid" INTEGER NOT NULL PRIMARY KEY,
"title" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"title" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"created" int(10) default \'0\' ,
"modified" int(10) default \'0\' ,
"text" text ,
Expand All @@ -305,19 +305,19 @@ public static function v0_6r9_4_3($db, $options)
$db->query('CREATE INDEX ' . $prefix . 'contents_created ON ' . $prefix . 'contents ("created")', Typecho_Db::WRITE);

$db->query('CREATE TABLE ' . $prefix . 'metas' . $uuid . ' ( "mid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"name" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"type" varchar(32) NOT NULL ,
"description" varchar(200) default NULL ,
"description" varchar(150) default NULL ,
"count" int(10) default \'0\' ,
"order" int(10) default \'0\' )', Typecho_Db::WRITE);
$db->query('INSERT INTO ' . $prefix . 'metas' . $uuid . ' SELECT * FROM ' . $prefix . 'metas', Typecho_Db::WRITE);
$db->query('DROP TABLE ' . $prefix . 'metas', Typecho_Db::WRITE);
$db->query('CREATE TABLE ' . $prefix . 'metas ( "mid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"name" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"type" varchar(32) NOT NULL ,
"description" varchar(200) default NULL ,
"description" varchar(150) default NULL ,
"count" int(10) default \'0\' ,
"order" int(10) default \'0\' )', Typecho_Db::WRITE);
$db->query('INSERT INTO ' . $prefix . 'metas SELECT * FROM ' . $prefix . 'metas' . $uuid, Typecho_Db::WRITE);
Expand Down Expand Up @@ -732,8 +732,8 @@ public static function v0_7r9_10_20($db, $options)
case false !== strpos($adapterName, 'SQLite'):
$uuid = uniqid();
$db->query('CREATE TABLE ' . $prefix . 'contents_tmp ( "cid" INTEGER NOT NULL PRIMARY KEY,
"title" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"title" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"created" int(10) default \'0\' ,
"modified" int(10) default \'0\' ,
"text" text ,
Expand All @@ -755,8 +755,8 @@ public static function v0_7r9_10_20($db, $options)
"allowPing", "allowFeed", "parent" FROM ' . $prefix . 'contents', Typecho_Db::WRITE);
$db->query('DROP TABLE ' . $prefix . 'contents', Typecho_Db::WRITE);
$db->query('CREATE TABLE ' . $prefix . 'contents ( "cid" INTEGER NOT NULL PRIMARY KEY,
"title" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"title" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"created" int(10) default \'0\' ,
"modified" int(10) default \'0\' ,
"text" text ,
Expand Down Expand Up @@ -1030,7 +1030,7 @@ public static function v0_9r13_11_24($db, $options)
$config = $db->getConfig();
$db->query("CREATE TABLE `{$prefix}fields` (
`cid` int(10) unsigned NOT NULL,
`name` varchar(200) NOT NULL,
`name` varchar(150) NOT NULL,
`type` varchar(8) default 'str',
`str_value` text,
`int_value` int(10) default '0',
Expand All @@ -1043,7 +1043,7 @@ public static function v0_9r13_11_24($db, $options)

case false !== strpos($adapterName, 'Pgsql'):
$db->query('CREATE TABLE "' . $prefix . 'fields" ("cid" INT NOT NULL,
"name" VARCHAR(200) NOT NULL,
"name" VARCHAR(150) NOT NULL,
"type" VARCHAR(8) NULL DEFAULT \'str\',
"str_value" TEXT NULL DEFAULT NULL,
"int_value" INT NULL DEFAULT \'0\',
Expand All @@ -1056,7 +1056,7 @@ public static function v0_9r13_11_24($db, $options)

case false !== strpos($adapterName, 'SQLite'):
$db->query('CREATE TABLE "' . $prefix . 'fields" ("cid" INTEGER NOT NULL,
"name" varchar(200) NOT NULL,
"name" varchar(150) NOT NULL,
"type" varchar(8) default \'str\',
"str_value" text,
"int_value" int(10) default \'0\',
Expand Down Expand Up @@ -1134,21 +1134,21 @@ public function v0_9r14_2_24($db, $options)
case false !== strpos($adapterName, 'SQLite'):
$uuid = uniqid();
$db->query('CREATE TABLE ' . $prefix . 'metas' . $uuid . ' ( "mid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"name" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"type" varchar(32) NOT NULL ,
"description" varchar(200) default NULL ,
"description" varchar(150) default NULL ,
"count" int(10) default \'0\' ,
"order" int(10) default \'0\' ,
"parent" int(10) default \'0\')', Typecho_Db::WRITE);
$db->query('INSERT INTO ' . $prefix . 'metas' . $uuid . ' ("mid", "name", "slug", "type", "description", "count", "order")
SELECT "mid", "name", "slug", "type", "description", "count", "order" FROM ' . $prefix . 'metas', Typecho_Db::WRITE);
$db->query('DROP TABLE ' . $prefix . 'metas', Typecho_Db::WRITE);
$db->query('CREATE TABLE ' . $prefix . 'metas ( "mid" INTEGER NOT NULL PRIMARY KEY,
"name" varchar(200) default NULL ,
"slug" varchar(200) default NULL ,
"name" varchar(150) default NULL ,
"slug" varchar(150) default NULL ,
"type" varchar(32) NOT NULL ,
"description" varchar(200) default NULL ,
"description" varchar(150) default NULL ,
"count" int(10) default \'0\' ,
"order" int(10) default \'0\' ,
"parent" int(10) default \'0\')', Typecho_Db::WRITE);
Expand Down
Loading

0 comments on commit fee8bcc

Please sign in to comment.