From 098793d6a5cf53bd3df015d46486537f56ca86a8 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 7 Apr 2021 10:09:36 +0200 Subject: Move concert logs creation date to db version 3 Just to make updating easier without having to nuke the db every time. --- includes/admin/register_db_tables.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/admin/register_db_tables.php b/includes/admin/register_db_tables.php index 8d9219e..ce1ea07 100644 --- a/includes/admin/register_db_tables.php +++ b/includes/admin/register_db_tables.php @@ -252,7 +252,7 @@ if ( !function_exists( "giglog_register_db_tables") ) function giglog_register_db_tables() { $db_version = get_option('giglogadmin_db_version'); - if ($db_version == 2) { + if ($db_version == 3) { return; } @@ -275,7 +275,6 @@ if ( !function_exists( "giglog_register_db_tables") ) `wpgcl_rev2` varchar(200) DEFAULT NULL, `wpgcl_int` varchar(200) DEFAULT NULL, `wpgcl_status` int(11) DEFAULT 1, - `wpgcl_createddate` date NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `wpglog_status` (`wpgcl_status`), KEY `wpglog_concerts` (`wpgcl_concertid`) @@ -407,7 +406,15 @@ if ( !function_exists( "giglog_register_db_tables") ) (6, 'Rejected');"); } - update_option("giglogadmin_db_version", 2); + if ($db_version == NULL || $db_version < 3) + { + $wpdb->query( + "ALTER TABLE `wpg_concertlogs` + ADD COLUMN IF NOT EXISTS + `wpgcl_createddate` date NOT NULL DEFAULT current_timestamp();"); + } + + update_option("giglogadmin_db_version", 3); } giglog_register_db_tables(); -- cgit v1.2.3