summaryrefslogtreecommitdiffstats
path: root/includes/admin/register_db_tables.php
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-06-15 18:34:29 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-06-15 18:34:29 +0200
commit1a8155ea64352b0eaf088675d51547361f6f17a7 (patch)
tree7da669474e0896cefbec89a16b65413a7ed25cb1 /includes/admin/register_db_tables.php
parentbfe4eb5efd705b64943a0e1c0b7e18bfe0eee4d8 (diff)
parent82c4a8f2c4e5acd80b813829cecc40f621da3b21 (diff)
downloadgigologadmin-1a8155ea64352b0eaf088675d51547361f6f17a7.tar.gz
gigologadmin-1a8155ea64352b0eaf088675d51547361f6f17a7.tar.bz2
gigologadmin-1a8155ea64352b0eaf088675d51547361f6f17a7.zip
Merge branch 'dev' of https://code.volse.net/wordpress/plugins/gigologadmin.git into andreaschanges
Diffstat (limited to 'includes/admin/register_db_tables.php')
-rw-r--r--includes/admin/register_db_tables.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/includes/admin/register_db_tables.php b/includes/admin/register_db_tables.php
index 11223b3..64123d9 100644
--- a/includes/admin/register_db_tables.php
+++ b/includes/admin/register_db_tables.php
@@ -260,7 +260,7 @@ if ( !function_exists( "giglog_register_db_tables") )
function giglog_register_db_tables()
{
$db_version = get_option('giglogadmin_db_version');
- if ($db_version == 5) {
+ if ($db_version == 6) {
return;
}
@@ -445,7 +445,21 @@ if ( !function_exists( "giglog_register_db_tables") )
"ALTER TABLE `wpg_concerts` DROP FOREIGN KEY `wpgconcert_band`;");
}
- update_option("giglogadmin_db_version", 5);
+ if ($db_version == NULL || $db_version < 6)
+ {
+ /*
+ * Move status and roles from concertlogs to main concerts table
+ * Don't really see the value in a separate table for these items
+ * Also make the roles fiels a JSON field instead of separate
+ * fields for each role.
+ */
+ $wpdb->query(
+ "ALTER TABLE `wpg_concerts` ADD COLUMN IF NOT EXISTS (
+ wpgconcert_status INT DEFAULT 1,
+ wpgconcert_roles JSON CHECK (JSON_VALID(wpgconcert_roles)))");
+ }
+
+ update_option("giglogadmin_db_version", 6);
}
giglog_register_db_tables();