From: Steve Sutton Date: Mon, 10 Oct 2016 19:46:09 +0000 (-0400) Subject: Adding database setup for the plugin X-Git-Tag: v1.0.0^2~9 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=e0159c5422c9d6a4701753993ef900fd10e2bc11;p=WP-Plugins%2Fglm-member-db-conditions.git Adding database setup for the plugin Adding tables and initial data for the plugin. --- diff --git a/index.php b/index.php index a2ed674..37ad36b 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,7 @@ * version from this plugin. */ define('GLM_MEMBERS_CONDITIONS_PLUGIN_VERSION', '0.0.7'); -// define('GLM_MEMBERS_CONDITIONS_PLUGIN_DB_VERSION', '0.0.1'); +define('GLM_MEMBERS_CONDITIONS_PLUGIN_DB_VERSION', '0.0.1'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_CONDITIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.57'); diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 56edf35..d0594e4 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -71,6 +71,7 @@ */ // Add a main menu item +/* add_menu_page( 'GLM Conditions', // Page Title 'GLM Conditions', // Menu Title @@ -80,9 +81,10 @@ add_menu_page( false, // Icon URL '4' // Menu Position ); + */ add_submenu_page( - 'glm-members-admin-menu-conditions', // Parent slug + 'glm-members-admin-menu-members', // Parent slug 'Conditions', // Page title 'Conditions', // Menu Title 'glm_members_members', // Capability required @@ -90,11 +92,3 @@ add_submenu_page( function() {$this->controller('conditions');} ); -add_submenu_page( - 'glm-members-admin-menu-conditions', // Parent slug - 'Info', // Page title - 'Info', // Menu Title - 'glm_members_members', // Capability required - 'glm-members-admin-menu-conditions-info', // Menu slug - function() {$this->controller('info');} -); diff --git a/setup/adminTabs.php b/setup/adminTabs.php index 70ae8fb..6be83db 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -44,7 +44,6 @@ * } * ); * - */ add_filter('glm-member-db-add-tab-for-members', function($addOnTabs) { @@ -59,4 +58,5 @@ add_filter('glm-member-db-add-tab-for-members', return $addOnTabs; } ); + */ diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql new file mode 100644 index 0000000..fbbf1cd --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -0,0 +1,55 @@ +-- Gaslight Media Members Database - Conditions +-- File Created: 12/02/15 15:27:15 +-- Database Version: 0.0.1 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most receint database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Conditions Table +CREATE TABLE {prefix}conditions ( + id INT NOT NULL AUTO_INCREMENT, + name TEXT NOT NULL, + descr_short TEXT NULL, + descr TEXT NULL, + last_update DATE NULL, + PRIMARY KEY (id) +); + +---- + +-- Current Conditions Table +CREATE TABLE {prefix}current_condition ( + id INT NOT NULL AUTO_INCREMENT, + cond_id INT NOT NULL, + special TEXT NULL, + last_update DATE NULL, + PRIMARY KEY (id) +); + +---- + +-- Conditions default entries in table +INSERT INTO {prefix}conditions ( id, name, last_update ) VALUES +( 1, 'All Clear, Have a Pleasant Trip!', NOW() ), +( 2, 'High Wind Warning', NOW() ), +( 3, 'Wind Escort', NOW() ), +( 4, 'Partial Bridge Closure', NOW() ), +( 5, 'Bridge Closed - High Winds', NOW() ), +( 6, 'Bridge Closed - General', NOW() ), +( 7, 'Bridge Closed - Weather', NOW() ), +( 8, 'Falling Ice Warning', NOW() ), +( 9, 'Bridge Closed - Falling Ice', NOW() ), +( 10, 'Fog Warning', NOW() ), +( 11, 'Blowing Snow Warning', NOW() ), +( 12, 'Special Condition', NOW() ) +; + +---- + +INSERT INTO {prefix}current_condition ( id, cond_id, last_update ) VALUES ( 1, 1, NOW() ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php new file mode 100644 index 0000000..0347305 --- /dev/null +++ b/setup/databaseScripts/dbVersions.php @@ -0,0 +1,39 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + + +/********************************************************************** + * NOTE: THIS IS A CONDITIONS FILE - DO NOT USE UNMODIFIED + * + * Please change all references to conditions, Conditions, or CONDITIONS to a name + * appropriate for your new Add-On. + * + * This file lists all versions of the database tables for this add-on. + * The last entry in the array below should be for the most recent + * version and should match the "create_database_V..." file in this + * directory. + * + * NOTE: When first creating a new add-on with database tables, there + * should only be one line in the array below and there should be no + * "update_database..." files in this directory. + * + * Remove this message before using this file in production! + **********************************************************************/ + + +$glmMembersConditionsDbVersions = array( + '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '10/10/2016'), +); + diff --git a/setup/databaseScripts/examples/create_database_V0.0.1.sql b/setup/databaseScripts/examples/create_database_V0.0.1.sql deleted file mode 100644 index 3705c64..0000000 --- a/setup/databaseScripts/examples/create_database_V0.0.1.sql +++ /dev/null @@ -1,42 +0,0 @@ --- Gaslight Media Members Database - Conditions --- File Created: 12/02/15 15:27:15 --- Database Version: 0.0.1 --- Database Creation Script --- --- This file is called to create a new set of tables for this --- add-on for the most receint database version for this add-on. --- --- There should only be one such file in this directory --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes - - --- ********************************************************************** --- NOTE: THIS IS A CONDITIONS FILE - DO NOT USE UNMODIFIED --- --- Please change all references to conditions, Conditions, or CONDITIONS to a name --- appropriate for your new Add-On. --- --- Tables and queries in this file are conditions only. --- --- Remove this message before using this file in production! --- **********************************************************************/ - - --- Conditions Table -CREATE TABLE {prefix}sometablename ( - id INT NOT NULL AUTO_INCREMENT, - somefield TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - --- Conditions default entry in table -INSERT INTO {prefix}sometablename - ( id, somefield ) - VALUES - ( 1, 'conditions data' ) -; - diff --git a/setup/databaseScripts/examples/dbVersions.php b/setup/databaseScripts/examples/dbVersions.php deleted file mode 100644 index 8e17b5e..0000000 --- a/setup/databaseScripts/examples/dbVersions.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ - */ - - -/********************************************************************** - * NOTE: THIS IS A CONDITIONS FILE - DO NOT USE UNMODIFIED - * - * Please change all references to conditions, Conditions, or CONDITIONS to a name - * appropriate for your new Add-On. - * - * This file lists all versions of the database tables for this add-on. - * The last entry in the array below should be for the most recent - * version and should match the "create_database_V..." file in this - * directory. - * - * NOTE: When first creating a new add-on with database tables, there - * should only be one line in the array below and there should be no - * "update_database..." files in this directory. - * - * Remove this message before using this file in production! - **********************************************************************/ - - -$glmMembersConditionsDbVersions = array( - '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '1/1/2016'), - '0.0.2' => array('version' => '0.0.2', 'tables' => 2) -); -