Changeset: f2e5f236ae9c https://sourceforge.net/p/mrbs/hg-code/ci/f2e5f236ae9c72eb2083fa623a4aa764c87eb8ff Author: Campbell Morrison <cimorri...@hg.code.sf.net> Date: Wed Apr 12 11:01:05 2017 +0100 Log message:
Merge with default diffstat: tables.my.sql | 2 +- tables.pg.sql | 2 +- web/dbsys.inc | 2 +- web/mrbs_sql.inc | 5 +++++ web/upgrade/50/mysql.sql | 5 +++++ web/upgrade/50/pgsql.sql | 4 ++++ web/upgrade/50/post.inc | 13 +++++++++++++ web/upgrade/51/mysql.sql | 1 + web/upgrade/51/post.inc | 16 ++++++++++++++++ 9 files changed, 47 insertions(+), 3 deletions(-) diffs (109 lines): diff -r 3cd7962a68ef -r f2e5f236ae9c tables.my.sql --- a/tables.my.sql Wed Apr 12 08:05:21 2017 +0100 +++ b/tables.my.sql Wed Apr 12 11:01:05 2017 +0100 @@ -190,6 +190,6 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO mrbs_variables (variable_name, variable_content) - VALUES ( 'db_version', '50'); + VALUES ( 'db_version', '51'); INSERT INTO mrbs_variables (variable_name, variable_content) VALUES ( 'local_db_version', '1'); diff -r 3cd7962a68ef -r f2e5f236ae9c tables.pg.sql --- a/tables.pg.sql Wed Apr 12 08:05:21 2017 +0100 +++ b/tables.pg.sql Wed Apr 12 11:01:05 2017 +0100 @@ -182,6 +182,6 @@ ); INSERT INTO mrbs_variables (variable_name, variable_content) - VALUES ('db_version', '50'); + VALUES ('db_version', '51'); INSERT INTO mrbs_variables (variable_name, variable_content) VALUES ('local_db_version', '1'); diff -r 3cd7962a68ef -r f2e5f236ae9c web/dbsys.inc --- a/web/dbsys.inc Wed Apr 12 08:05:21 2017 +0100 +++ b/web/dbsys.inc Wed Apr 12 11:01:05 2017 +0100 @@ -22,7 +22,7 @@ } -$db_schema_version = 50; +$db_schema_version = 51; $local_db_schema_version = 1; // Convenience wrapper function to provide access to a DB object for diff -r 3cd7962a68ef -r f2e5f236ae9c web/mrbs_sql.inc --- a/web/mrbs_sql.inc Wed Apr 12 08:05:21 2017 +0100 +++ b/web/mrbs_sql.inc Wed Apr 12 11:01:05 2017 +0100 @@ -1684,6 +1684,11 @@ $sql_val[] = "?"; $sql_params[] = $name; break; + case 'periods': + $sql_col[] = $key; + $sql_val[] = "?"; + $sql_params[] = json_encode($area_defaults[$key]); + break; default: if (array_key_exists($key, $area_defaults)) { diff -r 3cd7962a68ef -r f2e5f236ae9c web/upgrade/50/mysql.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/upgrade/50/mysql.sql Wed Apr 12 11:01:05 2017 +0100 @@ -0,0 +1,5 @@ +-- Add a field for the period names + +ALTER TABLE %DB_TBL_PREFIX%area + ADD COLUMN `periods` text CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL AFTER `enable_periods`; + \ No newline at end of file diff -r 3cd7962a68ef -r f2e5f236ae9c web/upgrade/50/pgsql.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/upgrade/50/pgsql.sql Wed Apr 12 11:01:05 2017 +0100 @@ -0,0 +1,4 @@ +-- Add a field for the period names + +ALTER TABLE %DB_TBL_PREFIX%area + ADD COLUMN periods text DEFAULT NULL; diff -r 3cd7962a68ef -r f2e5f236ae9c web/upgrade/50/post.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/upgrade/50/post.inc Wed Apr 12 11:01:05 2017 +0100 @@ -0,0 +1,13 @@ +<?php +namespace MRBS; + +// Populate the new periods column in the area table with the default values taken +// from the config file. + +global $tbl_area; +global $periods; +global $admin_handle; + +$sql = "UPDATE $tbl_area SET periods = ?"; + +$admin_handle->command($sql, array(json_encode($periods))); diff -r 3cd7962a68ef -r f2e5f236ae9c web/upgrade/51/mysql.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/upgrade/51/mysql.sql Wed Apr 12 11:01:05 2017 +0100 @@ -0,0 +1,1 @@ +# diff -r 3cd7962a68ef -r f2e5f236ae9c web/upgrade/51/post.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/upgrade/51/post.inc Wed Apr 12 11:01:05 2017 +0100 @@ -0,0 +1,16 @@ +<?php +namespace MRBS; + +// Make sure that any null values for the periods column are replaced with +// the config default. (It's possible that somebody working from the latest +// default branch could have created a new area with a null value. That has +// now been fixed, so won't happen again, but we need to clean up the area +// table just in case). + +global $tbl_area; +global $periods; +global $admin_handle; + +$sql = "UPDATE $tbl_area SET periods = ? WHERE periods IS NULL"; + +$admin_handle->command($sql, array(json_encode($periods))); ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mrbs-commits mailing list Mrbs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mrbs-commits