diff options
Diffstat (limited to 'install')
-rw-r--r-- | install/schema_mysql.sql | 16 | ||||
-rw-r--r-- | install/schema_postgres.sql | 14 | ||||
-rw-r--r-- | install/update.php | 52 |
3 files changed, 80 insertions, 2 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 5ee1ec463..1793f89c2 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -108,6 +108,8 @@ CREATE TABLE IF NOT EXISTS `app` ( `app_price` char(255) NOT NULL DEFAULT '', `app_page` char(255) NOT NULL DEFAULT '', `app_requires` char(255) NOT NULL DEFAULT '', + `app_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `app_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `app_id` (`app_id`), KEY `app_name` (`app_name`), @@ -115,7 +117,9 @@ CREATE TABLE IF NOT EXISTS `app` ( KEY `app_photo` (`app_photo`), KEY `app_version` (`app_version`), KEY `app_channel` (`app_channel`), - KEY `app_price` (`app_price`) + KEY `app_price` (`app_price`), + KEY `app_created` (`app_created`), + KEY `app_edited` (`app_edited`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `attach` ( @@ -823,6 +827,11 @@ CREATE TABLE IF NOT EXISTS `obj` ( `obj_type` int(10) unsigned NOT NULL DEFAULT '0', `obj_obj` char(255) NOT NULL DEFAULT '', `obj_channel` int(10) unsigned NOT NULL DEFAULT '0', + `obj_term` char(255) NOT NULL DEFAULT '', + `obj_url` char(255) NOT NULL DEFAULT '', + `obj_imgurl` char(255) NOT NULL DEFAULT '', + `obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, @@ -832,6 +841,11 @@ CREATE TABLE IF NOT EXISTS `obj` ( KEY `obj_page` (`obj_page`), KEY `obj_type` (`obj_type`), KEY `obj_channel` (`obj_channel`), + KEY `obj_term` (`obj_term`), + KEY `obj_url` (`obj_url`), + KEY `obj_imgurl` (`obj_imgurl`), + KEY `obj_created` (`obj_created`), + KEY `obj_edited` (`obj_edited`), KEY `obj_obj` (`obj_obj`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index c594d0f87..d31c304eb 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -107,6 +107,8 @@ CREATE TABLE "app" ( "app_price" text NOT NULL DEFAULT '', "app_page" text NOT NULL DEFAULT '', "app_requires" text NOT NULL DEFAULT '', + "app_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "app_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ("id") ); create index "app_id" on app ("app_id"); @@ -116,6 +118,8 @@ create index "app_photo" on app ("app_photo"); create index "app_version" on app ("app_version"); create index "app_channel" on app ("app_channel"); create index "app_price" on app ("app_price"); +create index "app_created" on app ("app_created"); +create index "app_edited" on app ("app_edited"); CREATE TABLE "attach" ( "id" serial NOT NULL, "aid" bigint NOT NULL DEFAULT '0', @@ -812,6 +816,11 @@ CREATE TABLE "obj" ( "obj_type" bigint NOT NULL DEFAULT '0', "obj_obj" text NOT NULL DEFAULT '', "obj_channel" bigint NOT NULL DEFAULT '0', + "obj_term" char(255) NOT NULL DEFAULT '', + "obj_url" char(255) NOT NULL DEFAULT '', + "obj_imgurl" char(255) NOT NULL DEFAULT '', + "obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "allow_cid" text NOT NULL, "allow_gid" text NOT NULL, "deny_cid" text NOT NULL, @@ -824,6 +833,11 @@ create index "obj_page" on obj ("obj_page"); create index "obj_type" on obj ("obj_type"); create index "obj_channel" on obj ("obj_channel"); create index "obj_obj" on obj ("obj_obj"); +create index "obj_term" on obj ("obj_term"); +create index "obj_url" on obj ("obj_url"); +create index "obj_imgurl" on obj ("obj_imgurl"); +create index "obj_created" on obj ("obj_created"); +create index "obj_edited" on obj ("obj_edited"); CREATE TABLE "outq" ( "outq_hash" text NOT NULL, diff --git a/install/update.php b/install/update.php index b398711b2..8e531b595 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1149 ); +define( 'UPDATE_VERSION' , 1151 ); /** * @@ -1748,3 +1748,53 @@ function update_r1148() { return UPDATE_FAILED; } + +function update_r1149() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + ADD obj_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + } + + $r2 = q("create index obj_term on obj ( obj_term ) "); + $r3 = q("create index obj_url on obj ( obj_url ) "); + $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) "); + $r5 = q("create index obj_created on obj ( obj_created ) "); + $r6 = q("create index obj_edited on obj ( obj_edited ) "); + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + +function update_r1150() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + ADD app_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + } + + $r2 = q("create index app_created on app ( app_created ) "); + $r3 = q("create index app_edited on app ( app_edited ) "); + + $r = $r1 && $r2 && $r3; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + |