Create indexes for the custom fields tables.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 14 Apr 2017 20:25:16 +0000 (16:25 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 14 Apr 2017 20:25:16 +0000 (16:25 -0400)
Indexing field name and the ref_dest and field_id.

index.php
setup/databaseScripts/create_database_V0.0.1.sql [deleted file]
setup/databaseScripts/create_database_V0.0.2.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.2.sql [new file with mode: 0644]

index da5b91b..9873cee 100644 (file)
--- a/index.php
+++ b/index.php
@@ -38,7 +38,7 @@
  *  version from this plugin.
  */
 define('GLM_MEMBERS_FIELDS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.2');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_FIELDS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql
deleted file mode 100644 (file)
index 1e14758..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
--- Gaslight Media Members Database - Fields Add-On
--- File Created: 2017-03-27
--- 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 recent 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
-
-
--- Field Setup Table
-CREATE TABLE {prefix}custom_fields (
-  id INT NOT NULL AUTO_INCREMENT,
-  field_name TINYTEXT NOT NULL DEFAULT '',      -- Field Name
-  field_type TINYTEXT NOT NULL DEFAULT '',      -- Field Type
-  field_order SMALLINT NOT NULL DEFAULT 0,      -- Order for Field
-  PRIMARY KEY (id)
-);
-
-----
-
--- Data Table
-CREATE TABLE {prefix}custom_field_data (
-  id INT NOT NULL AUTO_INCREMENT,
-  field_id INT NOT NULL DEFAULT 0,              -- Field Id
-  ref_dest INT NOT NULL DEFAULT 0,              -- Member Info Id
-  field_data TEXT NOT NULL DEFAULT '',          -- Data for the field
-  PRIMARY KEY (id)
-);
diff --git a/setup/databaseScripts/create_database_V0.0.2.sql b/setup/databaseScripts/create_database_V0.0.2.sql
new file mode 100644 (file)
index 0000000..293f7c4
--- /dev/null
@@ -0,0 +1,36 @@
+-- Gaslight Media Members Database - Fields Add-On
+-- File Created: 2017-03-27
+-- Database Version: 0.0.2
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most recent 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
+
+
+-- Field Setup Table
+CREATE TABLE {prefix}custom_fields (
+  id INT NOT NULL AUTO_INCREMENT,
+  field_name TINYTEXT NOT NULL DEFAULT '',      -- Field Name
+  field_type TINYTEXT NOT NULL DEFAULT '',      -- Field Type
+  field_order SMALLINT NOT NULL DEFAULT 0,      -- Order for Field
+  PRIMARY KEY (id),
+  INDEX(field_name(20))
+);
+
+----
+
+-- Data Table
+CREATE TABLE {prefix}custom_field_data (
+  id INT NOT NULL AUTO_INCREMENT,
+  field_id INT NOT NULL DEFAULT 0,              -- Field Id
+  ref_dest INT NOT NULL DEFAULT 0,              -- Member Info Id
+  field_data TEXT NOT NULL DEFAULT '',          -- Data for the field
+  PRIMARY KEY (id).
+  INDEX(field_id),
+  INDEX(ref_dest)
+);
index 6c5508f..29c7bd4 100644 (file)
@@ -15,5 +15,6 @@
 
 $glmMembersFieldsDbVersions = array(
     '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '03/27/2017'),
+    '0.0.2' => array('version' => '0.0.2', 'tables' => 2, 'date' => '04/14/2017'),
 );
 
diff --git a/setup/databaseScripts/update_database_V0.0.2.sql b/setup/databaseScripts/update_database_V0.0.2.sql
new file mode 100644 (file)
index 0000000..d1cef4c
--- /dev/null
@@ -0,0 +1,18 @@
+-- Gaslight Media Members Database
+-- File Created: 2017-04-14
+-- Database Version: 0.0.2
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+CREATE INDEX field_name ON {prefix}custom_fields(field_name(20));
+
+----
+
+CREATE INDEX field_id ON {prefix}custom_field_data(field_id);
+
+----
+
+CREATE INDEX ref_dest ON {prefix}custom_field_data(ref_dest);
+