diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-06-14 10:07:55 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-06-14 10:07:55 +0200 |
commit | 82c4a8f2c4e5acd80b813829cecc40f621da3b21 (patch) | |
tree | 6ea5d9a65eaaa616598072e91b7a7479406b8954 /includes/admin | |
parent | 68652c0546845de2f216d7fb285205e2eddf9d41 (diff) | |
download | gigologadmin-82c4a8f2c4e5acd80b813829cecc40f621da3b21.tar.gz gigologadmin-82c4a8f2c4e5acd80b813829cecc40f621da3b21.tar.bz2 gigologadmin-82c4a8f2c4e5acd80b813829cecc40f621da3b21.zip |
Begin move roles and status field to concerts table.
There's no need to have a separate table (concertlogs) for these fields.
Diffstat (limited to 'includes/admin')
-rw-r--r-- | includes/admin/register_db_tables.php | 18 |
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(); |