From 2a78fa940ecbaf3b0b51fefa00bed2624c947d8f Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 15 Nov 2016 16:52:20 -0500 Subject: [PATCH] Adding the tables and start of menu Adding Coupons to the glmAssoc menu Adding table setup script. --- setup/adminMenus.php | 9 ++- setup/databaseScripts/UltiSnips/sql.snippets | 9 +++ .../create_database_V0.0.1.sql | 66 +++++++++++++++++++ setup/databaseScripts/dbVersions.php | 19 ++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 setup/databaseScripts/UltiSnips/sql.snippets create mode 100644 setup/databaseScripts/create_database_V0.0.1.sql create mode 100644 setup/databaseScripts/dbVersions.php diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 292a8d9..a2a1604 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -49,4 +49,11 @@ * is named the same as the "glm_action" parameter. * */ - +add_submenu_page( + 'glm-members-admin-menu-members', + 'Coupons', + 'Coupons', + 'glm_members_members', + 'glm-members-admin-menu-coupons', + function(){$this->controller('coupons');} +); diff --git a/setup/databaseScripts/UltiSnips/sql.snippets b/setup/databaseScripts/UltiSnips/sql.snippets new file mode 100644 index 0000000..864ce4e --- /dev/null +++ b/setup/databaseScripts/UltiSnips/sql.snippets @@ -0,0 +1,9 @@ +snippet ctable +-- $1 +CREATE TABLE \{prefix\}$2 ( + id INT NOT NULL AUTO_INCREMENT, + $0, + PRIMARY KEY (id) +); + +endsnippet 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..d916acf --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -0,0 +1,66 @@ +-- Gaslight Media Members Database - Coupons Add-On +-- File Created: 11/15/16 +-- 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 + + +-- Coupons +CREATE TABLE {prefix}coupons ( + id INT NOT NULL AUTO_INCREMENT, + status INT NULL, -- Status of the Coupon (Active Pending) + created DATETIME NULL, -- Create date + updated DATETIME NULL, -- Update date + approved DATETIME NULL, -- Approved date + start_date DATE NULL, -- Starting date of the coupon + end_date DATE NULL, -- Ending date of the coupon + expire DATE NULL, -- Expire date of the coupon + name TINYTEXT NULL, -- Coupon name + name_slug TINYTEXT NULL, -- Coupon name slug + ref_type INT NULL, -- Ref type + ref_dest INT NULL, -- Id from ref type table + descr TEXT NULL, -- Description of the coupon + image TINYTEXT NULL, -- Coupon image + url TINYTEXT NULL, -- website of the coupon + PRIMARY KEY(id), + INDEX(ref_type), + INDEX(ref_dest), + INDEX(start_date), + INDEX(end_date) +); + +---- + +-- Categories +CREATE TABLE {prefix}categories ( + id INT NOT NULL AUTO_INCREMENT, + name TINYTEXT NULL, -- Category Name + PRIMARY KEY (id), + INDEX(name(20)) +); + +---- + +-- Settings +CREATE TABLE {prefix}settings ( + id INT NOT NULL AUTO_INCREMENT, + notify_to TINYTEXT NULL, -- To for the notify email + notify_from TINYTEXT NULL, -- From header for notify email + notify_message TEXT NULL, -- Message to add to the notify email + PRIMARY KEY (id) +); + +---- + +-- Data for Settings +INSERT INTO {prefix}settings +(id,notify_to,notify_from,notify_message) +VALUES +(1, '', '', ''); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php new file mode 100644 index 0000000..03688e7 --- /dev/null +++ b/setup/databaseScripts/dbVersions.php @@ -0,0 +1,19 @@ + + * @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/ + */ + +$glmMembersCouponsDbVersions = array( + '0.0.1' => array('version' => '0.0.1', 'tables' => 3), +); + -- 2.17.1