diff options
author | friendica <info@friendica.com> | 2015-04-23 19:49:41 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-04-23 19:49:41 -0700 |
commit | 6679734135fb04f4a7beccb81663bf1e9574f062 (patch) | |
tree | 887488543d98b5dd297d917718bdd99844e83ba5 /install/update.php | |
parent | 08b757a22cd2804bfec8ecf682b6987b8c06ca49 (diff) | |
parent | c696860cc53bc25558d83de5eda65d9b583da382 (diff) | |
download | volse-hubzilla-6679734135fb04f4a7beccb81663bf1e9574f062.tar.gz volse-hubzilla-6679734135fb04f4a7beccb81663bf1e9574f062.tar.bz2 volse-hubzilla-6679734135fb04f4a7beccb81663bf1e9574f062.zip |
Merge branch 'master' into tres
Conflicts:
include/Contact.php
include/ItemObject.php
include/api.php
include/attach.php
include/diaspora.php
include/dir_fns.php
include/enotify.php
include/event.php
include/expire.php
include/items.php
include/notifier.php
include/notify.php
include/photos.php
include/taxonomy.php
include/text.php
include/widgets.php
include/zot.php
mod/admin.php
mod/channel.php
mod/dirsearch.php
mod/display.php
mod/editwebpage.php
mod/events.php
mod/home.php
mod/item.php
mod/manage.php
mod/mood.php
mod/network.php
mod/page.php
mod/photos.php
mod/ping.php
mod/post.php
mod/thing.php
mod/viewsrc.php
view/css/mod_events.css
Diffstat (limited to 'install/update.php')
-rw-r--r-- | install/update.php | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/install/update.php b/install/update.php index 8ce50926a..36aa20373 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1136 ); +define( 'UPDATE_VERSION' , 1140 ); /** * @@ -26,10 +26,14 @@ define( 'UPDATE_VERSION' , 1136 ); * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file. * * If you change the database schema, the following are required: - * 1. Update the file database.sql to match the new schema. + * 1. Update the files schema_mysql.sql and schema_postgres.sql to match the new schema. + * Be sure to read doc/sql_conventions.bb ($yoururl/help/sql_conventions) use only standard + * SQL data types where possible to keep differences in the files to a minimum * 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION. * This function should modify the current database schema and perform any other steps necessary - * to ensure that upgrade is silent and free from requiring interaction. + * to ensure that upgrade is silent and free from requiring interaction. Review to ensure that it + * will run correctly on both postgres and MySQL/Mariadb. It is very difficult and messy to fix DB update + * errors. Once pushed, it requires a new update which undoes any damage and performs the corrected updated. * 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it * 4. TEST the upgrade prior to checkin and filing a pull request. * @@ -1518,7 +1522,7 @@ function update_r1133() { PRIMARY KEY (xp_id) )"); $r2 = 0; foreach(array('xp_client', 'xp_channel', 'xp_perm') as $fld) - $r2 += (empty(q("create index $fld on xperm ($fld)")) ? 0 : 1); + $r2 += ((q("create index $fld on xperm ($fld)") == false) ? 0 : 1); $r = (($r1 && $r2) ? true : false); } @@ -1558,3 +1562,44 @@ function update_r1135() { return UPDATE_SUCCESS; return UPDATE_FAILED; } + +function update_r1136() { + $r1 = q("alter table item add item_unseen smallint not null default '0' "); + $r2 = q("create index item_unseen on item ( item_unseen ) "); + $r3 = q("update item set item_unseen = 1 where ( item_flags & 2 ) > 0 "); + + if($r1 && $r2 && $r3) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1137() { + $r1 = q("alter table site add site_valid smallint not null default '0' "); + $r2 = q("create index site_valid on site ( site_valid ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1138() { + $r1 = q("alter table outq add outq_priority smallint not null default '0' "); + $r2 = q("create index outq_priority on outq ( outq_priority ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1139() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE channel ADD channel_lastpost timestamp NOT NULL DEFAULT '0001-01-01 00:00:00'"); + $r2 = q("create index channel_lastpost on channel ( channel_lastpost ) "); + $r = $r1 && $r2; + } + else + $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +}
\ No newline at end of file |