From 15e48cb95049c2c61bac19775b8169eb6966d811 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 18 Oct 2017 15:29:46 -0400 Subject: [PATCH] adding entity id and uid for group id to the database tables and the data class adding new columns for entity id and uid for the data abstract and the database tables --- classes/data/dataCustomFields.php | 15 ++++++++++++++- classes/data/dataCustomFieldsData.php | 8 +++++++- index.php | 2 +- ...se_V0.0.4.sql => create_database_V0.0.5.sql} | 7 +++++-- setup/databaseScripts/dbVersions.php | 1 + .../databaseScripts/update_database_V0.0.5.sql | 17 +++++++++++++++++ 6 files changed, 45 insertions(+), 5 deletions(-) rename setup/databaseScripts/{create_database_V0.0.4.sql => create_database_V0.0.5.sql} (77%) create mode 100644 setup/databaseScripts/update_database_V0.0.5.sql diff --git a/classes/data/dataCustomFields.php b/classes/data/dataCustomFields.php index b860f62..d6cc38b 100644 --- a/classes/data/dataCustomFields.php +++ b/classes/data/dataCustomFields.php @@ -129,7 +129,20 @@ class GlmDataFieldsCustomFields extends GlmDataAbstract 'required' => true, 'use' => 'a' ), - + // Entity ID (event, member, package) + 'entity_id' => array ( + 'field' => 'entity_id', + 'type' => 'integer', + 'view_only' => false, + 'use' => 'a' + ), + // group id + 'uid' => array ( + 'field' => 'uid', + 'type' => 'integer', + 'view_only' => false, + 'use' => 'a' + ), // Category ID 'field_type' => array( 'field' => 'field_type', diff --git a/classes/data/dataCustomFieldsData.php b/classes/data/dataCustomFieldsData.php index c7a7148..0bcbd3e 100644 --- a/classes/data/dataCustomFieldsData.php +++ b/classes/data/dataCustomFieldsData.php @@ -121,7 +121,13 @@ class GlmDataFieldsCustomFieldsData extends GlmDataAbstract 'view_only' => true, 'use' => 'a' ), - + // Entity ID (event, member, package) + 'entity_id' => array ( + 'field' => 'entity_id', + 'type' => 'integer', + 'view_only' => false, + 'use' => 'a' + ), // Event ID 'field_id' => array( 'field' => 'field_id', diff --git a/index.php b/index.php index 5d83803..b6da06a 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_FIELDS_PLUGIN_VERSION', '1.0.3'); -define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.4'); +define('GLM_MEMBERS_FIELDS_PLUGIN_DB_VERSION', '0.0.5'); // 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.4.sql b/setup/databaseScripts/create_database_V0.0.5.sql similarity index 77% rename from setup/databaseScripts/create_database_V0.0.4.sql rename to setup/databaseScripts/create_database_V0.0.5.sql index cdb4b53..976ec62 100644 --- a/setup/databaseScripts/create_database_V0.0.4.sql +++ b/setup/databaseScripts/create_database_V0.0.5.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database - Fields Add-On -- File Created: 2017-03-27 --- Database Version: 0.0.4 +-- Database Version: 0.0.5 -- Database Creation Script -- -- This file is called to create a new set of tables for this @@ -19,7 +19,9 @@ CREATE TABLE {prefix}custom_fields ( field_type TINYTEXT NOT NULL DEFAULT '', -- Field Type field_order SMALLINT NOT NULL DEFAULT 0, -- Order for Field admin_search BOOLEAN NOT NULL DEFAULT '0', -- If the field is added to member list filters. - required BOOLEAN NOT NULL DEFAULT '0', -- If the field is arequired. + required BOOLEAN NOT NULL DEFAULT '0', -- If the field is required. + uid INT NOT NULL, -- id for the series of custom fields associated with an entity + entity_id INT NOT NULL, -- id for the specific field associated with an entity PRIMARY KEY (id), INDEX(field_name(20)) ); @@ -32,6 +34,7 @@ CREATE TABLE {prefix}custom_field_data ( 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 + entity_id INT NOT NULL, -- id for the specific field associated with an entity PRIMARY KEY (id), INDEX(field_id), INDEX(ref_dest) diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index dc0810e..e69523e 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -18,5 +18,6 @@ $glmMembersFieldsDbVersions = array( '0.0.2' => array('version' => '0.0.2', 'tables' => 2, 'date' => '04/14/2017'), '0.0.3' => array('version' => '0.0.3', 'tables' => 2, 'date' => '04/24/2017'), '0.0.4' => array('version' => '0.0.4', 'tables' => 2, 'date' => '10/18/2017'), + '0.0.5' => array('version' => '0.0.5', 'tables' => 2, 'date' => '10/18/2017'), ); diff --git a/setup/databaseScripts/update_database_V0.0.5.sql b/setup/databaseScripts/update_database_V0.0.5.sql new file mode 100644 index 0000000..749ad8e --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.5.sql @@ -0,0 +1,17 @@ +-- Gaslit Media Members Database +-- File Created: 2017-04-14 +-- Database Version: 0.0.5 +-- 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 dashes + +ALTER TABLE {prefix}custom_fields ADD COLUMN uid INT; + +---- + +ALTER TABLE {prefix}custom_field_data ADD COLUMN entity_id INT; + +---- + +ALTER TABLE {prefix}custom_field_data ADD COLUMN uid INT; \ No newline at end of file -- 2.17.1