Adding database setup for the plugin
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 10 Oct 2016 19:46:09 +0000 (15:46 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 10 Oct 2016 19:46:09 +0000 (15:46 -0400)
Adding tables and initial data for the plugin.

index.php
setup/adminMenus.php
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.1.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php [new file with mode: 0644]
setup/databaseScripts/examples/create_database_V0.0.1.sql [deleted file]
setup/databaseScripts/examples/dbVersions.php [deleted file]

index a2ed674..37ad36b 100644 (file)
--- 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');
index 56edf35..d0594e4 100644 (file)
@@ -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');}
-);
index 70ae8fb..6be83db 100644 (file)
@@ -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 (file)
index 0000000..fbbf1cd
--- /dev/null
@@ -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 (file)
index 0000000..0347305
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Conditions DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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 (file)
index 3705c64..0000000
+++ /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 (file)
index 8e17b5e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members Conditions DB Versions
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @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)
-);
-