First DB version should install now.
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 6 Feb 2017 16:10:45 +0000 (11:10 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 6 Feb 2017 16:10:45 +0000 (11:10 -0500)
Updated the create_database file with additional indexes and other alterations.
Corrected a problem with the database versions table name.

misc/documentation/DevelopmentOutline.txt
setup/databaseScripts/create_database_V0.0.1.sql
setup/databaseScripts/dbVersions.php

index 5d8575f..80db076 100644 (file)
@@ -2,7 +2,7 @@ Registrations Add-On Work Items - Preliminary
 
 ADMIN
 
-* General
+* General - Chuck
     - Activation/Deactivation
     - Database table installation / updates
     - Generasl Configuration
@@ -38,7 +38,7 @@ ADMIN
     - Associated with a specific Event
     - Add, Update, Delete list of registration classes for an event
 
-* Rgistration Rates
+* Registration Rates
     - Associated with a specific registration class
     - Add, Update, Delete list of rates
         - Sets a range of dates over which a particular registration class may be selected and the rates for that date range
index e3f02ce..9e43764 100644 (file)
  *          reg_rates - Date range / rate for a reg class (one or more)
  *              
  * reg_account - Describes someone who submits / pays for a registration
- * 
+ * Make these two things the same table....
  * registrant - A person who is registered for an event
  * 
  * reg_request - Information on a specific request for registrations
- *      reg_request_detail - Event selected (one or more)
+ *      reg_request_event - Event selected (one or more)
  *          reg_request_class - Class of registration (one or more)
  *              reg_request_rate - Specific registration date/rate (one or more)
- *                  reg_registrant - Registrant (one or more)
+ *                  reg_request_registrant - Registrant (one or more)
  * 
  * 
  * Overall Flow
@@ -69,6 +69,7 @@
 
 -- Management Options
 -- General configurationm parameters for the Registrations application
+-- Only one entry in this table!
 CREATE TABLE {prefix}management (
     id INT NOT NULL AUTO_INCREMENT,
     -- System Owner Information
@@ -131,16 +132,43 @@ CREATE TABLE {prefix}management (
 
 ----
 
+-- Misc system-wide customer configurable configuration
+-- Various text and flags to be configured by customer
+-- Only one entry in this table!
+CREATE TABLE {prefix}misc (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_bulletin TEXT NULL,                                     -- Text to display at top of first registration page
+    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
+    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
+    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
+    reg_terms TEXT NULL,                                        -- Registration terms and conditions
+    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
+    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
+    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
+    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
+    submission_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to person submitting the registrations
+    submission_notify_text TEXT NULL,                           -- Notification E-Mail text to person submitting the registrations
+    registrant_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to registrant
+    registrant_notify_text TEXT NULL,                           -- Text of notification E-Mail to registrant
+    submission_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to person submitting the registrations
+    submission_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail text to person submitting the registrations
+    registrant_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to registrant
+    registrant_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail to registrant
+    PRIMARY KEY (id)
+);
+
+----
+
 -- Additional fields for collecting information for various things - submission, event registration, or registrant
 -- Related to the registration submission or specific event registration
 CREATE TABLE {prefix}added_info_fields (
     id INT NOT NULL AUTO_INCREMENT,
     ref_type TINYINT NULL,                                      -- See data_ref_type table in plugin.ini 
-    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
+    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type - (not user submitted data record)
     name TINYTEXT NULL,                                         -- Displayed field prompt - also used on retrieval of data
     description TINYTEXT NULL,                                  -- Description of field - possibly to display to user
     PRIMARY KEY (id),
-    INDEX(ref_dest(20))
+    INDEX (ref_dest)
 );
 
 ----
@@ -149,8 +177,11 @@ CREATE TABLE {prefix}added_info_fields (
 CREATE TABLE {prefix}added_info_data (
     id INT NOT NULL AUTO_INCREMENT,
     added_info_field INT NULL,                                  -- Pointer to added_info_field table
-    field_value TINYTEXT NULL,
-    PRIMARY KEY (id)
+    ref_type TINYINT NULL,                                      -- See data ref_type table in plugin.ini
+    ref_dest INT NULL,                                          -- Pointer to specific entryt of the correct type (user submitted data record)
+    field_value TINYTEXT NULL,                                  
+    PRIMARY KEY (id),
+    INDEX (ref_dest)
 );
 
 
@@ -218,37 +249,19 @@ CREATE TABLE {prefix}mf_temp_file (
 
 ----
 
--- Misc system-wide customer configurable configuration
--- Various text and flags to be configured by customer
-CREATE TABLE {prefix}misc (
-    id INT NOT NULL AUTO_INCREMENT,
-    regbulletin TEXT NULL,                                      -- Text to display at top of first registration page
-    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
-    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
-    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
-    regterms TEXT NULL,                                         -- Registration terms and conditions
-    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
-    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
-    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
-    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
-    req_ack_subject TEXT NULL,                                  -- Subject of registration acknowledgement E-Mail to customer
-    req_ack_text TEXT NULL,                                     -- Text of registration acknowledgement E-Mail to customer
-    PRIMARY KEY (id)
-);
-
-----
-
 -- Payment Codes
 -- Promotional payment codes for free/discounted payment
 CREATE TABLE {prefix}payment_code (
     id INT NOT NULL AUTO_INCREMENT,
     code_type TINYINT NULL,                                     -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini
     ref_type TINYINT NULL,                                      -- See payment_ref_type in plugin.ini
-    ref_dest INT NULL                                           -- Pointer to the specific entity of ref_type
+    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
     code TINYTEXT NULL,                                         -- Text code user must enter to use 
     amount FLOAT,                                               -- Amount of discount if not type "Free" - Either $ amount or percent
     descr TEXT NULL, 
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (ref_dest),
+    INDEX (code(10))
 );
 
 ----
@@ -261,13 +274,13 @@ CREATE TABLE {prefix}reg_event (
     event INT NULL,                                             -- Pointer to event in Events add-on
     event_code TINYTEXT NULL,                                   -- A short code used to reference this event - can be used to directly select an event to register for
     notify_email TINYTEXT NULL,                                 -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated
+    admin_active BOOLEAN NULL,                                  -- Active flag for admin from Events - If false, then does not show as a link from events to manage event. Still shows in registrations admin
     active BOOLEAN NULL,                                        -- Active flag to indicate that this event is available for registrations
     attendees BOOLEAN NULL,                                     -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
     attendee_max MEDIUMINT NULL,                                -- Attendee limit - 0 = unlimited
     attendee_max_per_reg TINYINT NULL,                          -- Maximum attendees per registration submission - 0 = unlimited
     attendee_count MEDIUMINT NULL,                              -- Last calculated attendee count
     registration_account_options TINYINT NULL,                  -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini
-    member_contact INT NULL,                                    -- Pointer to member contact ID if logged in member submitting registration
     payment_methods TINYINT NULL,                               -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini
     restricted_payment_methods TINYINT NULL,                    -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method
     terms TEXT NULL,                                            -- Terms and Conditions for registration
@@ -275,19 +288,22 @@ CREATE TABLE {prefix}reg_event (
     reg_file_title TINYTEXT NULL,                               -- Title for downloadable file
     form_revision SMALLINT NULL,                                -- Current MagicForm form revision
     notes TEXT NULL,                                            -- System operator's notes for this event - Not visible to users
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (event),
+    INDEX (event_code(10))
 );
 
 ----
 
--- Rate Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
+-- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
 -- One or more for each event
 CREATE TABLE {prefix}reg_class (
     id INT NOT NULL AUTO_INCREMENT,
     reg_event INT NULL,                                         -- Pointer to reg_event table
     name TINYTEXT NULL,                                         -- Name of this registration type
     descr TEXT NULL,                                            -- Description
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (reg_event)
 );
 
 ----
@@ -297,13 +313,15 @@ CREATE TABLE {prefix}reg_class (
 CREATE TABLE {prefix}reg_rates (
     id INT NOT NULL AUTO_INCREMENT,
     reg_event INT NULL,                                         -- Pointer to reg_event table
-    reg_class INT NULL,                                          -- Pointer to reg_class table
+    reg_class INT NULL,                                         -- Pointer to reg_class table
     start_days INT NULL,                                        -- # of days before event time rate becomes available - may be entered as a date then coverted for storage
     end_days INT NULL,                                          -- # of days before event time rate becomes unavailable
     base_rate FLOAT,                                            -- Base rate to register
     per_registrant FLOAT,                                       -- Rate per registrant
     registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_class)
 );
 
 ----
@@ -313,9 +331,10 @@ CREATE TABLE {prefix}reg_rates (
 -- A single account may be referenced as a person submitting registrations and/or a person registered for an event
 CREATE TABLE {prefix}account (
     id INT NOT NULL AUTO_INCREMENT,
-    active BOOLEAN NULL,                                -- Is active flag (may be accessed or used) - default is true
-    registered_by INT NULL,                             -- Account
-    fname TINYTEXT NULL,                                    -- Account primary address
+    active BOOLEAN NULL,                                        -- Is active flag (may be accessed or used) - default is true
+    registered_by INT NULL,                                     -- Account
+    member_id TINYTEXT NULL,                                    -- Free-form field for a member ID (not a GLM Associate member ID)
+    fname TINYTEXT NULL,                                        -- Account primary address
     lname TINYTEXT NULL,
     org TINYTEXT NULL,
     title TINYTEXT NULL,
@@ -327,7 +346,7 @@ CREATE TABLE {prefix}account (
     country TINYTEXT NULL,
     phone TINYTEXT NULL,
     fax TINYTEXT NULL,
-    bill_fname TINYTEXT NULL,                               -- Last used billing information - Also stored in each registration request
+    bill_fname TINYTEXT NULL,                                   -- Last used billing information - Also stored in each registration request
     bill_lname TINYTEXT NULL,
     bill_org TINYTEXT NULL,
     bill_title TINYTEXT NULL,
@@ -340,10 +359,10 @@ CREATE TABLE {prefix}account (
     bill_phone TINYTEXT NULL,
     bill_fax TINYTEXT NULL,
     email TINYTEXT NULL,
-    password TINYTEXT NULL,                                 -- Crypted password for login back into this account
+    password TINYTEXT NULL,                                     -- Crypted password for login back into this account
     email_ok BOOLEAN NULL,
-    is_member BOOLEAN NULL,                                 -- Is a member of the entity that owns the site
-    member_id TINYTEXT NULL,                                -- Free-form field for a member ID
+    is_member BOOLEAN NULL,                                     -- Is a member of the entity that owns the site
+    contact_id INT NULL,                                        -- Pointer to GLM Associate member contact record if account is for a member contact
     contact_fname TINYTEXT NULL,
     contact_lname TINYTEXT NULL,
     contact_org TINYTEXT NULL,
@@ -364,45 +383,19 @@ CREATE TABLE {prefix}account (
     med_history TINYTEXT NULL,
     allergy_med TINYTEXT NULL,
     date_created DATE NULL,
-    notes TEXT NULL,                                        -- System operator's notes for this account - not visible to account owner
-    user_trace_info TINYTEXT NULL,                          -- IP Address of user computer and timestamp of last update
-    PRIMARY KEY (id)
-);
-
-----
-
--- Aperson who is registered for one or more events
--- Depending on the use of these entries may not have all data included
-CREATE TABLE {prefix}registrant (
-    id INT NOT NULL AUTO_INCREMENT,
-    active BOOLEAN NULL,                                -- Is active flag (may be accessed or used) - default is true
-    registered_by INT NULL,                             -- Account
-    fname TINYTEXT NULL,                                    -- Account primary address
-    lname TINYTEXT NULL,
-    org TINYTEXT NULL,
-    title TINYTEXT NULL,
-    addr1 TINYTEXT NULL,
-    addr2 TINYTEXT NULL,
-    city TINYTEXT NULL,
-    state TINYTEXT NULL,
-    zip TINYTEXT NULL,
-    country TINYTEXT NULL,
-    phone TINYTEXT NULL,
-    fax TINYTEXT NULL,
-    email TINYTEXT NULL,
-    password TINYTEXT NULL,                                 -- Crypted password for login back into this account
-    email_ok BOOLEAN NULL,
-    is_member BOOLEAN NULL,                                 -- Is a member of the entity that owns the site
-    member_id TINYTEXT NULL,                                -- Free-form field for a member ID
-    guardian TINYTEXT NULL,
-    emer_contact TINYTEXT NULL,
-    emer_phone TINYTEXT NULL,
-    med_history TINYTEXT NULL,
-    allergy_med TINYTEXT NULL,
-    date_created DATE NULL,
-    notes TEXT NULL,                                        -- System operator's notes for this account - not visible to account owner
-    user_trace_info TINYTEXT NULL,                          -- IP Address of user computer and timestamp of last update
-    PRIMARY KEY (id)
+    notes TEXT NULL,                                            -- System operator's notes for this account - not visible to account owner
+    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp of last update
+    PRIMARY KEY (id),
+    INDEX (registered_by),
+    INDEX (member_id(10)),
+    INDEX (fname(10)),
+    INDEX (lname(10)),
+    INDEX (org(10)),
+    INDEX (city(10)),
+    INDEX (state(5)),
+    INDEX (zip(5)),
+    INDEX (email(10)),
+    INDEX (contact_id)    
 );
 
 ----
@@ -438,59 +431,98 @@ CREATE TABLE {prefix}reg_request (
     notes TEXT NULL,                                            -- System operator's notes for this registration request
     user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp
     PRIMARY KEY (id),
-    INDEX(cart_serial(20))
+    INDEX (account),
+    INDEX (date_submitted)
 );
 
 ----
 
 -- Registration for a specific event
 -- Has one or more reg_selected_rate records associated with it
-CREATE TABLE {prefix}reg_request_detail (
+CREATE TABLE {prefix}reg_request_event (
     id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to account (person submitting the registration)
     reg_request INT NULL,                                       -- Pointer to reg_request table
-    account INT NULL                                            -- Pointer to account (person submitting the registration)
     event INT NULL,                                             -- Pointer to reg_event
     event_time INT NULL,                                        -- Pointer to event_times table entry in Events add-on
     total_charge FLOAT,                                         -- Last calculated total of all charges for registration to this event for all registrants 
     notes TEXT NULL,                                            -- System operator's notes for this registration request
     mf_data TEXT NULL,                                          -- Any MagicForm data associated with requested event
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (reg_request),
+    INDEX (account),
+    INDEX (event),
+    INDEX (event_time)
+);
+
+----
+
+--  A particular reg_class selected
+--  Has one or more reg_request_rate records associated with it
+CREATE TABLE {prefix}reg_request_class (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to account (person submitting the registration)
+    event INT NULL,                                             -- Pointer to reg_event entry
+    event_time INT NULL,                                        -- Pointer to event_times table entry in Events add-on - To help with registrant searches
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    total_class_charge FLOAT,                                   -- Last calculated total of all charges for this registration class for this request 
+    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (event),
+    INDEX (event_time),
+    INDEX (reg_request_event)
 );
 
 ----
 
---  A particular reg_request_rate selected
---  Has one or more reg_registrant records associated with it
+--  A particular reg_rate selected
+--  Has one or more reg_request_registrant records associated with it
 CREATE TABLE {prefix}reg_request_rate (
     id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to account (person submitting the registration)
     event INT NULL,                                             -- Pointer to reg_event entry
     event_time INT NULL,                                        -- Pointer to event_times table entry in Events add-on - To help with registrant searches
-    reg_request_detail INT NULL,                                -- Pointer to reg_request_detail table entry
-    reg_detail INT NULL,                                        -- Pointer to reg_detail table entry
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
     rate_base FLOAT,                                            -- Base rate at time of registration
     per_registrant FLOAT,                                       -- Per Registrant Rate at time of registration
     registrant_credits TINYINT NULL,                            -- Number of registrant credits in base rate at time of registration
     numb_registrants FLOAT,                                     -- Last calculated number of registrants with this rate
     total_registrant_charges FLOAT,                             -- Last calculation registrant charges assoicated with this selected rate
+    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
     notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (event),
+    INDEX (event_time),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class)
 );
 
 ----
 
 --  A specific registrant for a selected registration rate
-CREATE TABLE {prefix}reg_registrant (
+CREATE TABLE {prefix}reg_request_registrant (
     id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to account for person submitting the registration
     event INT NULL,                                             -- Pointer to reg_event entry
     event_time INT NULL,                                        -- Pointer to event_times table entry in Events add-on - To help with registrant searches
-    reg_request_detail INT NULL,                                -- Pointer to reg_request_detail table entry
-    reg_detail INT NULL,                                        -- Pointer to reg_detail table entry
-    account INT NULL,                                           -- Pointer to account (person submitting the registration)
-    registrant INT NULL,                                        -- Pointer to registrant (person attending) - Not needed if registrants are off for the event
-    reg_selected_rate INT NULL,                                 -- Pointer to reg_selected_rate table entry
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
+    reg_request_rate INT NULL,                                  -- Pointer to reg_request_rate table entry
+    reg_request_registrant INT NULL,                            -- Pointer to account for registrant (person attending) - Not needed if registrants are off for the event
     mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
     notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id)
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (event),
+    INDEX (event_time),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class),
+    INDEX (reg_request_rate),
+    INDEX (reg_request_registrant)
 );
 
 ----
@@ -599,35 +631,46 @@ INSERT INTO {prefix}management
     'Contact Information'                                      -- title_contact_information
     );
 
-
 ----
 
 -- Insert into misc table
 INSERT INTO {prefix}misc
     (
-    regbulletin,
+    reg_bulletin,
     cart_page_text,
     checkout_page_text,
     summary_page_text,
-    regterms,
-    instr_notify_subject,
-    instr_notify_text,
+    reg_terms,
     notify_subject,
     notify_text,
-    req_ack_subject,
-    req_ack_text
+    instr_notify_subject,
+    instr_notify_text,
+    submission_notify_subject,
+    submission_notify_text,
+    registrant_notify_subject,
+    registrant_notify_text,
+    submission_ack_subject,
+    submission_ack_text,
+    registrant_ack_subject,
+    registrant_ack_text
     )
     VALUES
     (
-    '',
-    '',
-    '',
-    '',
+    'Registration Bulletin Text',
+    'Text for top of Cart Page',
+    'Text for top of Checkout Page',
+    'Text for top of Summary Page',
     'Terms and Conditions',
-    'Notification of a Registration',
-    '',
-    'Notification of a Registration'
-    'You have a new Registration.',
-    'Acknowledgement of your Registration',
-    'Thank You for registering for this event. You will also receive a reminder email 1-2 days before the event. If your plans, change please call or email to cancel your reservation so those on the wait list can attend.  We look forward to seeing you soon.'
+    'Subject of notification to site owner of a registration',
+    'Text of notification to site owner of a registration',
+    'Subject of notification to instructor of registration',
+    'Text for notification to instructor of registration',
+    'Subject of notification to person submitting registration',
+    'Text of notification to person submitting registration',
+    'Subject for notification to registrant',
+    'Text for notification to registrant',
+    'Subject of acknowledgement to person submitting registration',
+    'Text of acknowledgement to person submitting registration',
+    'Subject of acknowledgement to registrant',
+    'Text of acknowledgement to registrant'
     );
index 9393fac..4f312a4 100644 (file)
@@ -12,9 +12,9 @@
  * @release  dbVersions.php $
  * @link     http://dev.gaslightmedia.com/
  */
-/*
-$glmMembersRegistrationDbVersions = array(
-    '0.0.1' => array('version' => '0.0.1', 'tables' => 17, 'date' => '02/2/2017'),
+
+$glmMembersRegistrationsDbVersions = array(
+    '0.0.1' => array('version' => '0.0.1', 'tables' => 17, 'date' => '02/6/2017')
 );
-*/
+