summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-01-16 21:42:34 +0100
committerHarald Eilertsen <haraldei@anduin.net>2021-01-17 15:09:27 +0100
commit5c0d96cc7cd1b4b477f264d7dec73c652d3b4490 (patch)
tree94d82623e33a406529e477479a646106a72abc17 /includes
parent6320b18c48cfff7c9712688e9866c2ba9b18125a (diff)
downloadgigologadmin-5c0d96cc7cd1b4b477f264d7dec73c652d3b4490.tar.gz
gigologadmin-5c0d96cc7cd1b4b477f264d7dec73c652d3b4490.tar.bz2
gigologadmin-5c0d96cc7cd1b4b477f264d7dec73c652d3b4490.zip
Skip setting up db if db version is ok.
Introduces a database schema version which we store in the wordpress options table. We could just use a flag, but if the schema ever will change, it will be good to have it versioned.
Diffstat (limited to 'includes')
-rw-r--r--includes/admin/register_db_tables.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/admin/register_db_tables.php b/includes/admin/register_db_tables.php
index 2c41771..c6d40f5 100644
--- a/includes/admin/register_db_tables.php
+++ b/includes/admin/register_db_tables.php
@@ -248,6 +248,11 @@ if (!function_exists('gigologadmin_populate_countries')) {
}
if ( !function_exists( "gigolog_register_db_tables") ) {
+ $db_version = get_option('gigologadmin_db_version');
+ if ($db_version == 1) {
+ return;
+ }
+
function gigolog_register_db_tables() {
$bands_table =
"CREATE TABLE IF NOT EXISTS `wpg_bands` (
@@ -383,6 +388,8 @@ if ( !function_exists( "gigolog_register_db_tables") ) {
ADD CONSTRAINT `wpgconcert_venue`
FOREIGN KEY (`venue`)
REFERENCES `wpg_venues` (`id`) ON DELETE NO ACTION;");
+
+ update_option("gigologadmin_db_version", 1);
}
gigolog_register_db_tables();