0% found this document useful (0 votes)
64 views24 pages

NewSchema With Table Descriptions

This document outlines the database schema for a marketing and messaging system. It includes tables for notifications, messages, templates, marketing series, campaigns, schedules, and user preferences and profiles. Relationships between the tables are defined using foreign keys to link related records across the various entities in the system.

Uploaded by

Zaheer Uddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views24 pages

NewSchema With Table Descriptions

This document outlines the database schema for a marketing and messaging system. It includes tables for notifications, messages, templates, marketing series, campaigns, schedules, and user preferences and profiles. Relationships between the tables are defined using foreign keys to link related records across the various entities in the system.

Uploaded by

Zaheer Uddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

members messages

PK message_id int AUTO NOT NULL


notifications statuses
FK sender_id int NOT NULL
PK notification_id int AUTO NOT NULL
FK recipient_id int NOT NULL
FK notification_type_id int NOT NULL
FK status_id int NOT NULL
FK priority_id int NOT NULL
FK message_type_id int NOT NULL
FK status_id int NOT NULL
message text NOT NULL
title varchar(255) NULL
created_at datetime NOT NULL
body text NOT NULL
updated_at datetime NOT NULL
starts_at datetime NULL

ends_at datetime NULL notificationTypes


priorities
created_at datetime NOT NULL PK notification_type_id int AUTO NOT NULL

updated_at datetime NOT NULL type varchar(255) NOT NULL

memberNotifications created_at datetime NOT NULL

PK member_notification_id int AUTO NOT NULL updated_at datetime NOT NULL

FK notification_id int NOT NULL


marketingSeries
FK status_id int NOT NULL
PK marketing_series_id int AUTO NOT NULL
FK member_id int NOT NULL
name varchar(255) NOT NULL
created_at datetime NOT NULL
description text NOT NULL
updated_at datetime NOT NULL
version varchar(50) NOT NULL

created_at datetime NOT NULL

templateImages updated_at datetime NOT NULL

PK template_image_id int AUTO NOT NULL deleted_at datetime NULL

FK template_id int NOT NULL


templates
path text NOT NULL
PK template_id int AUTO NOT NULL
file_name text NOT NULL
name varchar(255) NOT NULL
px_width NOT NULL templateSections
description text NULL
px_height int NOT NULL PK template_section_id int AUTO NOT NULL
version varchar(50) NOT NULL
logo_image boolean NOT NULL FK template_id int NOT NULL
header_text text NULL
created_at datetime NOT NULL name varchar(255) NOT NULL
header_html text NULL
updated_at datetime NOT NULL order int NOT NULL
footer_text text NULL
text_body text NULL
footer_html text NULL
html_body text NULL
created_at datetime NOT NULL
created_at datetime NOT NULL
updated_at datetime NOT NULL
updated_at datetime NOT NULL
deleted_at datetime NULL
messageTypes emailBlacklist
emails
PK message_type_id int AUTO NOT NULL PK email_blacklist_id int AUTO NOT NULL
phones
type varchar(255) NOT NULL FK email_id int NOT NULL

created_at datetime NOT NULL reason text NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

updated_at datetime NOT NULL

seriesSchedules
marketingSeriesCampaigns
PK series_schedule_id int AUTO NOT NULL
PK marketing_series_campaign_id int AUTO NOT NULL
FK marketing_series_id int NOT NULL
FK marketing_series_id int NOT NULL
FK trigger_id int NOT NULL
FK campaign_id int NOT NULL
interval int NOT NULL
campaign_order int NOT NULL
created_at datetime NOT NULL

campaigns updated_at datetime NOT NULL

PK campaign_id int AUTO NOT NULL


campaignSchedules
FK priority_id int NOT NULL
PK campaign_schedule_id int AUTO NOT NULL
name varchar(255) NOT NULL
FK campaign_id int NOT NULL
version varchar(50) NOT NULL
FK trigger_id int NOT NULL
created_at datetime NOT NULL
interval int NOT NULL
updated_at datetime NOT NULL
created_at datetime NOT NULL
priorities
updated_at datetime NOT NULL

members
campaignTemplates
templateSchedules
PK campaign_template_id int AUTO NOT NULL
PK template_schedule_id int AUTO NOT NULL
FK campaign_id int NOT NULL
FK member_id int NOT NULL
FK template_id int NOT NULL
FK template_id int NOT NULL
template_order int NOT NULL
FK time_of_day_restriction_id int NOT NULL

FK communication_medium_id int NOT NULL

FK trigger_id int NULL


timeOfDayRestrictions
content text NOT NULL
PK time_of_day_restriction_id int AUTO NOT NULL
created_at datetime NOT NULL
earliest_time time NOT NULL
updated_at datetime NOT NULL
latest_time time NOT NULL

created_at datetime NOT NULL preferences

updated_at datetime NOT NULL


phoneBlacklist

PK phone_blacklist_id int AUTO NOT NULL

FK phone_id int NOT NULL

reason text NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL

notificationTriggers

PK notification_trigger_id int AUTO NOT NULL

FK notification_id int NOT NULL

FK trigger_id int NOT NULL

triggers

PK trigger_id int AUTO NOT NULL

monthweek int NULL

monthday int NULL

weekday int NULL

onAction_table varchar(255) NULL

onAction_action enum NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL

deleted_at datetime NULL

scheduleRecipients

PK schedule_recipient_id int AUTO NOT NULL

FK member_id int NULL

FK template_schedule_id int NOT NULL

FK communication_medium_id int NOT NULL

communicationMediums

PK communication_medium_id int AUTO NOT NULL

medium varchar(50) NOT NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL

deleted_at datetime NULL


members memberPreferences

PK member_id int AUTO NOT NULL PK member_preference_id int AUTO NOT NULL

FK membership_id int NOT NULL FK member_id int NOT NULL

FK language_id int NOT NULL FK member_profile_picture_id int NOT NULL timeOfDayRestrictions

FK timezone_id int NOT NULL FK country_id int NOT NULL

FK linked_member_id int NOT NULL background text NULL

first_name varchar(255) NOT NULL display_name varchar(255) NULL

last_name varchar(255) NOT NULL mentor_url text NOT NULL

gender enum NOT NULL referral_url text NOT NULL


brandCommunications
auth_email_id int NOT NULL date_format varchar(255) NULL

username varchar(255) NULL font_size enum NOT NULL

password text NOT NULL filter_preferred_brands boolean NOT NULL

password_hint text NOT NULL profile_publicly_visible boolean NOT NULL

created_at datetime NOT NULL enable_texts boolean NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

deleted_at datetime NULL updated_at datetime NOT NULL

phones memberProfilePictures

PK phone_id int AUTO NOT NULL PK member_profile_picture_id int AUTO NOT NULL

phone_number varchar(50) NOT NULL path text NOT NULL

FK member_id int NOT NULL file_name text NOT NULL

FK priority_id int NOT NULL height int NOT NULL

created_at datetime NOT NULL width int NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

deleted_at datetime NULL updated_at datetime NOT NULL

phoneBlacklist brandCommunications priorities memberAssignments

PK member_assignment_id int AUTO NOT NULL


emails emailBlacklist
FK member_id int NOT NULL
PK email_id int AUTO NOT NULL
FK mentor_member_id int NOT NULL
email text NOT NULL brandCommunications
FK status_id int NOT NULL
FK member_id int NOT NULL
created_at datetime NOT NULL
FK priority_id int NOT NULL
updated_at datetime NOT NULL
created_at datetime NOT NULL

updated_at datetime NOT NULL

deleted_at datetime NULL


preferences memberFavorites

PK preference_id int AUTO NOT NULL PK member_favorite_id int AUTO NOT NULL healthProducts

FK member_preference_id int NOT NULL FK member_id int NOT NULL

FK preference_identifier int NOT NULL FK favorite_identifier int NOT NULL


testimonials
preference_type enum NOT NULL favorite_type enum NOT NULL

created_at datetime NOT NULL FK list_id int NULL


lists
updated_at datetime NOT NULL created_at datetime NOT NULL

updated_at datetime NOT NULL


contactPreferences

PK contact_preference_id int AUTO NOT NULL memberShares

type varchar(255) NOT NULL PK member_share_id int AUTO NOT NULL sharedTestimonials

created_at datetime NOT NULL FK member_id int NOT NULL

updated_at datetime NOT NULL FK status_id int NOT NULL

email text NOT NULL


printoutTypes
share_first varchar(255) NOT NULL
PK printout_type_id int AUTO NOT NULL
share_last varchar(255) NOT NULL
type varchar(255) NOT NULL
subject varchar(255) NOT NULL
created_at datetime NOT NULL
body text NOT NULL
updated_at datetime NOT NULL
created_at datetime NOT NULL

updated_at datetime NOT NULL

deleted_at datetime NULL

statuses

skills memberSkills

PK skill_id int AUTO NOT NULL PK member_skill_id int AUTO NOT NULL

skill varchar(255) NOT NULL FK member_id int NOT NULL

created_at datetime NOT NULL FK skill_id int NOT NULL

updated_at datetime NOT NULL


memberRoles
memberMLMs
PK member_role_id int AUTO NOT NULL
PK member_mlm_id int AUTO NOT NULL
FK member_id int NOT NULL
FK member_id int NOT NULL brands
FK role_id int NOT NULL
FK brand_id int NULL
admin boolean NOT NULL
distributor_id text NULL
created_at datetime NOT NULL
business_builder bool NOT NULL
updated_at datetime NOT NULL
created_at datetime NOT NULL

updated_at datetime NOT NULL


roles

memberBusinesses guests

PK member_business_id int AUTO NOT NULL PK guest_id int AUTO NOT NULL

FK member_id int NOT NULL source_url text NOT NULL

business_name varchar(255) NOT NULL phone varchar(50) NULL

business_url text NULL email text NULL

created_at datetime NOT NULL FK referral_member_id int NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

updated_at datetime NOT NULL


roles rolePermissions

PK role_id int AUTO NOT NULL PK role_permission_id int AUTO NOT NULL

role_name varchar(255) NOT NULL FK role_id int NOT NULL

created_at datetime NOT NULL FK permission_id int NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

deleted_at datetime NULL updated_at datetime NOT NULL

deleted_at datetime NULL


memberRoles

permissionTargets
permissions
PK permission_target_id int AUTO NOT NULL
PK permission_id int AUTO NOT NULL
FK target_id int NOT NULL
permission_action enum NOT NULL faqs
FK permission_id int NOT NULL
permission_title varchar(255) NOT NULL PK faq_id int AUTO NOT NULL
permission_type enum NOT NULL
created_at datetime NOT NULL FK list_id int NOT NULL
created_at datetime NOT NULL
updated_at datetime NOT NULL summary text NOT NULL
updated_at datetime NOT NULL
deleted_at datetime NULL question text NOT NULL

answer text NOT NULL


memberPreferences
created_at datetime NOT NULL

updated_at datetime NOT NULL


countries currencies

PK country_id int AUTO NOT NULL PK currency_id int AUTO NOT NULL
emails
name varchar(255) NOT NULL FK country_id int NOT NULL
phones
iso2 varchar(10) NULL currency varchar(255) NOT NULL

iso3 varchar(10) NULL iso3 varchar(10) NULL priorities

created_at datetime NOT NULL unicode_symbol varchar(20) NULL PK priority_id int AUTO NOT NULL

updated_at datetime NOT NULL thousands_delimiter varchar(10) NULL level varchar(255) NOT NULL

decimal_delimiter varchar(10) NULL FK list_id int NULL

created_at datetime NOT NULL created_at datetime NOT NULL


languages
updated_at datetime NOT NULL updated_at datetime NOT NULL
PK language_id int AUTO NOT NULL

name varchar(255) NOT NULL


timezones lists
iso2 varchar(10) NULL
PK timezone_id int AUTO NOT NULL PK list_id int AUTO NOT NULL
iso3 varchar(10) NULL
abbreviation varchar(20) NULL list_name varchar(255) NOT NULL
created_at datetime NOT NULL
name varchar(255) NOT NULL created_at datetime NOT NULL
updated_at datetime NOT NULL
location varchar(255) NULL updated_at datetime NOT NULL

offset varchar(20) NOT NULL deleted_at datetime NULL


members
pages memberships

PK page_id int AUTO NOT NULL PK membership_id int AUTO NOT NULL

page_title varchar(255) NOT NULL plan_title varchar(255) NOT NULL

created_at datetime NOT NULL monthly_cost double NOT NULL

updated_at datetime NOT NULL yearly_cost double NOT NULL

deleted_at datetime NULL created_at datetime NOT NULL

updated_at datetime NOT NULL


modules
deleted_at datetime NULL
PK module_id int AUTO NOT NULL

module_name varchar(255) NOT NULL membershipData

created_at datetime NOT NULL PK membership_data_id int AUTO NOT NULL

updated_at datetime NOT NULL FK membership_id int NOT NULL

deleted_at datetime NULL data_key varchar(255) NOT NULL

data_value text NOT NULL


resources
created_at datetime NOT NULL
PK resource_id int AUTO NOT NULL
updated_at datetime NOT NULL
resource_title varchar(255) NOT NULL
deleted_at datetime NULL
resource_location text NOT NULL

created_at datetime NOT NULL paymentMemberships

updated_at datetime NOT NULL PK payment_membership_id int AUTO NOT NULL

deleted_at datetime NOT NULL FK membership_id int NOT NULL

FK payment_vendor_id int NOT NULL


functions
created_at datetime NOT NULL
PK function_id int AUTO NOT NULL
updated_at datetime NOT NULL
members
function_title varchar(255) NOT NULL
deleted_at datetime NULL
function_location text NOT NULL

created_at datetime NOT NULL paymentVendors

updated_at datetime NOT NULL PK payment_vendor_id int AUTO NOT NULL

deleted_at datetime NULL vendor_title varchar(255) NOT NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL


memberFavorites
purchases purchaseProducts

PK purchase_id int AUTO NOT NULL PK purchase_product_id int AUTO NOT NULL

FK payment_vendor_id int NOT NULL FK purchase_id int NOT NULL

FK member_id int NOT NULL product_id text NOT NULL

discount double NOT NULL created_at datetime NOT NULL

amount double NOT NULL

fees double NOT NULL


purchaseSubscriptions
taxes double NOT NULL
PK purchase_subscription_id int AUTO NOT NULL
created_at datetime NOT NULL
FK purchase_id int NOT NULL
updated_at datetime NOT NULL
subscription_id text NOT NULL
deleted_at datetime NULL
created_at datetime NOT NULL

paymentSources

PK payment_source_id int AUTO NOT NULL purchaseSources

FK member_id int NOT NULL PK purchase_source_id int AUTO NOT NULL

default boolean NOT NULL FK purchase_id int NOT NULL

created_at datetime NOT NULL FK payment_source_id int NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

deleted_at datetime NULL

paymentCustomVariables

PK payment_custom_variable_id int AUTO NOT NULL

FK custom_id int NOT NULL

custom_type enum NOT NULL

custom_key text NOT NULL

statuses custom_value text NOT NULL

PK status_id int AUTO NOT NULL created_at datetime NOT NULL

status varchar(255) NOT NULL updated_at datetime NOT NULL

FK list_id int NULL deleted_at datetime NULL

created_at datetime NOT NULL


memberAssignments
updated_at datetime NOT NULL
memberShares
members
countries

statuses

brandSocialProfiles
brands
PK brand_social_profile_id int AUTO NOT NULL
PK brand_id int AUTO NOT NULL
FK brand_id int NOT NULL
FK status_id int NOT NULL
social_media_url text NOT NULL
FK country_id int NOT NULL
social_media_platform varchar(255) NOT NULL
company_name text NOT NULL
created_at datetime NOT NULL
is_mlm boolean NOT NULL
updated_at datetime NOT NULL
website_url text NULL

created_at datetime NOT NULL healthProducts

updated_at datetime NOT NULL PK health_product_id int AUTO NOT NULL

deleted_at NULL product_name varchar(255) NOT NULL

created_at datetime NOT NULL


brandCommunications
updated_at datetime NOT NULL
PK brand_communication_id int AUTO NOT NULL
deleted_at datetime NULL
FK communication_id int NOT NULL

communication_type enum NOT NULL topics

FK contact_preference_id int NOT NULL PK topic_id int AUTO NOT NULL

FK priority_id int NOT NULL topic varchar(255) NOT NULL

created_at datetime NOT NULL health_related boolean NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

updated_at datetime NOT NULL


priorities
deleted_at datetime NULL
contactPreferences

phones

emails
testimonialComments

PK testimonial_comment_id int AUTO NOT NULL

testimonials FK testimonial_id int NOT NULL

PK testimonial_id int AUTO NOT NULL FK status_id int NOT NULL

FK member_id int NOT NULL FK member_id int NOT NULL

FK status_id int NOT NULL body text NOT NULL

title varchar(255) NOT NULL business_related boolean NOT NULL

body text NOT NULL created_at datetime NOT NULL

health_related boolean NOT NULL updated_at datetime NOT NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL


studies

PK study_id int AUTO NOT NULL


articles
title varchar(255) NOT NULL
PK article_id int AUTO NOT NULL
summary text NULL
FK status_id int NOT NULL
link text NULL
site text NOT NULL
created_at datetime NOT NULL
keywords text NULL
updated_at datetime NOT NULL
body text NOT NULL

created_at datetime NOT NULL


searches
members
updated_at datetime NOT NULL
PK search_id int AUTO NOT NULL

FK member_id int NOT NULL


healthProductJoins
search_text text NOT NULL
PK health_product_join_id int AUTO NOT NULL
created_at datetime NOT NULL
FK health_product_id int NOT NULL
updated_at datetime NOT NULL
FK join_id int NOT NULL

join_type enum NOT NULL


searchResults

topicJoins PK search_result_id int AUTO NOT NULL

PK topic_join_id int AUTO NOT NULL FK search_id int NOT NULL

FK topic_id int NOT NULL FK testimonial_id int NOT NULL

FK join_id int NOT NULL created_at datetime NOT NULL

join_type enum NOT NULL updated_at datetime NOT NULL


testimonialCommentLikes

PK testimonial_comment_like_id int AUTO NOT NULL

FK testimonial_comment_id int NOT NULL

FK member_id int NOT NULL

created_at datetime NOT NULL

testimonialImages

PK testimonial_image_id int AUTO NOT NULL

FK testimonial_id int NOT NULL

path text NOT NULL

file_name text NOT NULL

height int NOT NULL

width int NOT NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL

sharedTestimonials
memberShares
PK shared_testimonial_id int AUTO NOT NULL

FK member_share_id int NOT NULL

FK testimonial_id int NOT NULL

created_at datetime NOT NULL

updated_at datetime NOT NULL


emailRecipientLogs

PK email_recipient_log_id int AUTO NOT NULL emailLogs

FK email_log_id int NOT NULL PK email_log_id int AUTO NOT NULL

FK recipient_email_id int NOT NULL FK sending_email_id int NOT NULL

cc boolean NOT NULL subject text NOT NULL

bcc boolean NOT NULL body text NOT NULL

created_at datetime NOT NULL created_at datetime NOT NULL

marketingSeries campaigns

marketingSeriesLogs campaignLogs
emails
PK marketing_series_log_id int AUTO NOT NULL PK campaign_log_id int AUTO NOT NULL
members
FK marketing_series_id int NOT NULL FK campaign_id int NOT NULL

FK status_id int NOT NULL FK marketing_series_log_id int NOT NULL

created_at datetime NOT NULL FK status_id int NOT NULL

updated_at datetime NOT NULL created_at datetime NOT NULL

deleted_at datetime NULL updated_at datetime NOT NULL

deleted_at datetime NULL

campaignEmailLogs

PK campaign_email_log_id int AUTO NOT NULL

FK campaign_log_id int NOT NULL

FK email_log_id int NOT NULL

statuses

bounceLogs
bounceTypes
PK bounce_log_id int AUTO NOT NULL
PK bounce_type_id int AUTO NOT NULL memberLogs
FK email_log_id int NOT NULL
bounce_description text NOT NULL PK member_log_id int AUTO NOT NULL
FK recipient_email_id int NOT NULL
bounce_code varchar(255) NOT NULL FK member_id int NOT NULL
FK bounce_type_id int NOT NULL
created_at datetime NOT NULL FK status_id int NOT NULL
notes text NULL
updated_at datetime NOT NULL ip_address varchar(255) NULL
action_taken varchar(255) NOT NULL
browser varchar(255) NULL
created_at datetime NOT NULL
session_start datetime NOT NULL
updated_at datetime NOT NULL
session_end datetime NOT NULL
notifications

notificationMetrics responseTypes

PK notification_metric_id int AUTO NOT NULL PK response_type_id int AUTO NOT NULL

FK notification_id int NOT NULL type varchar(255) NOT NULL

FK member_id int NOT NULL created_at datetime NOT NULL

FK response_type_id int NOT NULL updated_at datetime NOT NULL

created_at datetime NOT NULL

memberMetrics campaignMetrics

PK member_metric_id int AUTO NOT NULL PK campaign_metric_id int AUTO NOT NULL

FK metric_id int NOT NULL FK metric_id int NOT NULL

source_table varchar(255) NOT NULL source_table varchar(255) NOT NULL

FK metric_type_id int NOT NULL FK metric_type_id int NOT NULL

metric_data text NOT NULL metric_data text NOT NULL

created_at datetime NOT NULL created_at datetime NOT NULL

updated_at datetime NOT NULL updated_at datetime NOT NULL

testimonialMetrics

PK testimonial_metric_id int AUTO NOT NULL


Log postfixed tables will be tables
FK metric_id int NOT NULL capturing events that occur within the
system.
source_table varchar(255) NOT NULL
Audit postfixed tables will be tables
FK metric_type_id int NOT NULL capturing data changes that occur within
the system.
metric_data text NOT NULL
Metric postfixed tables will be tables
specifically capturing interactions that
created_at datetime NOT NULL occur within the system.

updated_at datetime NOT NULL

phones

emails

campaigns

optInMetrics metricTypes

PK opt_in_metric_id int AUTO NOT NULL PK metric_type_id int AUTO NOT NULL

FK campaign_id int NOT NULL metric_key varchar(255) NOT NULL

FK communication_id int NOT NULL data_type varchar(255) NOT NULL

communication_type enum NOT NULL created_at datetime NOT NULL

created_at datetime NOT NULL updated_at datetime NOT NULL


marketingSeriesAudits testimonialAudits

PK marketing_series_audit_id int AUTO NOT NULL PK testimonial_audit_id int AUTO NOT NULL

FK member_id int NOT NULL FK member_id int NOT NULL

FK table_id int NOT NULL FK table_id int NOT NULL

table_name varchar(255) NOT NULL table_name varchar(255) NOT NULL

field_name varchar(255) NOT NULL field_name varchar(255) NOT NULL

old_value text NOT NULL old_value text NOT NULL

new_value text NOT NULL new_value text NOT NULL

created_at datetime NOT NULL created_at datetime NOT NULL

paymentAudits templateAudits

PK payment_audit_id int AUTO NOT NULL PK template_audit_id int AUTO NOT NULL

FK member_id int NOT NULL FK member_id int NOT NULL

FK table_id int NOT NULL FK table_id int NOT NULL

table_name varchar(255) NOT NULL table_name varchar(255) NOT NULL


members
field_name varchar(255) NOT NULL field_name varchar(255) NOT NULL

old_value text NOT NULL old_value text NOT NULL

new_value text NOT NULL new_value text NOT NULL

created_at datetime NOT NULL created_at datetime NOT NULL

memberAudits brandAudits

PK member_audit_id int AUTO NOT NULL PK brand_audit_id int AUTO NOT NULL

FK member_id int NOT NULL FK member_id int NOT NULL

FK table_id int NOT NULL FK table_id int NOT NULL

table_name varchar(255) NOT NULL table_name varchar(255) NOT NULL

field_name varchar(255) NOT NULL field_name varchar(255) NOT NULL

old_value text NOT NULL old_value text NOT NULL

new_value text NOT NULL new_value text NOT NULL

created_at datetime NOT NULL created_at datetime NOT NULL


campaignAudits

PK campaign_audit_id int AUTO NOT NULL

FK member_id int NOT NULL

FK table_id int NOT NULL

table_name varchar(255) NOT NULL

field_name varchar(255) NOT NULL

old_value text NOT NULL

new_value text NOT NULL

created_at datetime NOT NULL

triggerAudits

PK trigger_audit_id int AUTO NOT NULL

FK member_id int NOT NULL

FK table_id int NOT NULL

table_name varchar(255) NOT NULL

field_name varchar(255) NOT NULL

old_value text NOT NULL

new_value text NOT NULL

created_at datetime NOT NULL

rolePermissionAudits

PK role_permission_audit_id int AUTO NOT NULL

FK member_id int NOT NULL

FK table_id int NOT NULL

table_name varchar(255) NOT NULL

field_name varchar(255) NOT NULL

old_value text NOT NULL

new_value text NOT NULL

created_at datetime NOT NULL


Communications Module
Table name: notifications
Description:
Notifications system allows for us to schedule notifications via the starts_at and ends_at identifiers in the case
that we need system wide notices. Otherwise just use created_at and updated_at for notices that members need to
acknowledge to dismiss. Priority > created_at determines which notices appear first, status_id from
memberNotifications will determine whether or not the notification has been dismissed.
Table name: messages
Description:
Messages are communication between members or admin to members or from members to guests outside of
OT. Sender_id and recipient_id are self explanatory, status_id involves the current state of the message and whether or
not it has been sent or received, message_type_id will detail as to whether or not it is an internal OT message, email,
text or other form of communication.
Table name: messageTypes
Description:
This is a static table, the types should remain relatively unchanged. Types should be as follows: Guest Email,
Guest Text, Guest Internal Message, Email, Text, Internal Message, Other.
Table name: memberNotifications
Description:
MemberNotifications will allow us to track a status for notifications that have been received by the members and
whether or not they have dismissed or otherwise responded to them.
Table name: marketingSeries
Description:
The marketingSeries table allows us to schedule a series of campaigns (campaigns featuring individual
promotions)
Table name: marketingSeriesCampaigns
Description:
A joining table that also adds in the order of the campaign in relation to the marketing series it is attached to.
Table name: templates
Description:
Previously this was two different series of tables, now it is one. Assuming this is not an email template, the
header_html and footer_html fields will be empty and possibly the _text postfixed fields too, sections would be required
and perhaps images too. Assuming this is an email template, then header and footer fields are needed to specify those
parts of the template. It should also be noted that if the promotion is going onto a social media platform, then the _html
and or _text postfix fields will also be filled in.
Table name: templateImages
Description:
This will store any images associated with templates, doing so within it's own table allows for the variables
stored in a template (or section) to pull whatever image it needs from a single source.
Table name: templateSections
Description:
Basically the body of the template, but doing so this way allows us to reuse or append multiple sections to a
single template.
Table name: campaigns
Description:
Campaigns are series of promotions, or a group of related promotions that can be sent out on a schedule and if
triggered by member actions.
Table name: emailBlacklist
Description:
This table contains all emails that have registered within the bounce system or for some other reason have
been labeled as such that we do not and will not send an email to this address. We should also store the reason we're
not sending emails to this address any more.
Table name: campaignTemplates
Description:
A joining table that also adds in the template order in relation to the campaign it is assigned to.
Table name: templateSchedules
Description:
This table tracks when to send a template, the individual whom is sending the communication, the
communication medium to use to send it and what time of day will be appropriate to send said communication. As well,
the content field will contain a JSON document to fill in all of the variables contained in the prescribed template so that
when it is time, the system can replace said variables in the template using the contents contained here and then send
the communication. Additionally, a template can be sent without requiring a campaign or marketing series to be created
and attached first, so we can also trigger individual templates too.
Table name: campaignSchedules
Description:
CampaignSchedules details when to send various templates / promotions of the campaign as well as the
interval that should occur between each communication.
Table name: seriesSchedules
Description:
SeriesSechedules detail when to trigger a marketing series as well as the interval of when to start a new
campaign.
Table name: timeOfDayRestrictions
Description:
Holds time of day values used in determining when to send scheduled communication. Will largely remain a
static table with a standard 4 chunks of the day, and then three, two and one hour increments.
Table name: triggers
Description:
This table stores possible triggers for various schedules or operations in the system. Monthweek can have a
value from 0 - 3 (4 possible values indicating which week of the month to trigger), monthday can have a value from 0 -
30 (31 possible values indicating which day of the month to trigger), and weekday can have a value of 0 - 6 (7 possible
values indicating which day of the week to trigger). OnAction_table can select a specific table and with the
accompanying enum onAction_action we can select either 'create' or 'update' or 'delete' as a value to trigger a
communication.
Table name: communicationMediums
Description:
CommunicationMediums is a static table that contains the methods of delivery for communication with the
members, the medium will have the following possible values: email, text, www. The 'www' signifies that this
communication will be pushed out to a social media platform.
Table name: scheduleRecipients
Description:
This table tracks all of the recipients various communication has been sent to. This table allows us to send
communication to either an existing member, guest email or a guest phone.
Table name: notificationTypes
Description:
This table determines the types of notifications that the members can receive, said values can be admin,
system, mentor or member. Admin basically means an admin needs you to fix / change something or they need some
information from you or need you to do something. System means auto-generated notification to let you know
something has been sent or done or that you have completed something to a satisfactory degree. Mentor is basically
that your mentor wants you to perform some sort of action and lastly member means someone else is requesting some
form of acknowledgement from you for some sort of action that they took.
Member Module
Table name: members
Description:
Members table holds details regarding all members using the application. Linked_member_id is used to
delineate a spouse who should have joint access to the account, mentor_member_id would specify the member that
referred this member to the application.
Table name: memberPreferences
Description:
This table has the member_id associated with it and various properties and settings that members can
configure. The font_size enum has three potential values of 'small', 'regular', and 'large'.
Table name: preferences
Description:
The purpose of this table is to track various preference settings all in one table rather than having a ton of
smaller tables. The preference_type enum should have the following values: printoutTypes, notificationTypes, brands,
timeOfDayRestrictions, contactPreferences.
Table name: memberProfilePictures
Description:
This table contains profile pictures for every member whom has one in place.
Table name: printoutTypes
Description:
This table contains details regarding physical printouts for members.
Table name: contactPreferences
Description:
This table specifies whether or not we want to be contacted by phone, email, text or internal message, the
corresponding priority will tell us which one of those to use first.
Table name: phones
Description:
This table stores phone numbers for members. The priority_id indicates the order in which to contact a number
in the case that a member has more than one contact number.
Table name: emails
Description:
This table stores emails for members. The priority_id indicates the order in which to contact a number in the
case that a member has more than one contact number.
Table name: memberAssignments
Description:
This table is used to determine the mentor for a member and the member's current status in relation to the
system.
Table name: memberFavorites
Description:
This table contains links to members' favorite testimonials, oils, or products. The favorite_type will specify table
names where the favorite_identifier is pulled from, as an enum it will presently have the following values: testimonials
and health_products.
Table name: memberShares
Description:
This table tracks emails that members are sending to their contact list to invite to join this platform.
Table name: guests
Description:
This table defines priority levels throughout the application.
Core Module
Table name: roles
Description:
Roles are assigned to members (admin or otherwise) and determine whether or not they have access to certain
functionality within the application based on the permissions that the role is assigned.
Table name: permissions
Description:
Permissions detail out the name of the permission and the allowable actions it provides, the actions enum
referring to basic CRUD operations. Permissions get into the more granular level of what can be accessed.
Table name: permissionTargets
Description:
This table contains identities from different tables and uses the permission_type enum to determine which table
the identity belongs to. Enum values: pages, modules, resources, functions.
Table name: membershipData
Description:
This table contains all necessary key / value data and details to piece together the membership diagram.
Table name: paymentMemberships
Description:
This table links the custom vendor product and price identifiers to the specific membership level so that when
subscriptions or payments are setup or accepted we can reference them here.
Table name: paymentVendors
Description:
This table contains the vendor name and credentials for accessing the vendor's API in order to process
payments.
Table name: purchases
Description:
This table gives us which vendor the member used to make a payment and the totals for said purchase.
Table name: purchaseSubscriptions
Description:
This table links a purchase with a vendor-specific subscription identifier if this is a recurring purchase.
Table name: paymentSources
Description:
This table stores the member's payment sources with the vendor and, working in conjunction with the
customVariables table, stores the vendor's source identifier for the member and their preferred method of payment. We
do not need to store or remember what payment type the member used (I.E. debit card, credit card), we let the vendor
take care of that information.
Table name: purchaseSources
Description:
This table links a purchase with x number of payment sources, in case a member needs to use more than one
to complete a purchase.
Table name: purchaseProducts
Description:
This table links a purchase with a vendor-specific product identifier if the member is making a one-time
purchase.
Table name: paymentCustomVariables
Description:
This table stores vendor specific identifiers via custom_key and custom_value. From paymentSources we store
the source_id, from paymentVendors we store the credential key and value pair, from paymentMemberships we store
product_id and price_id, this way we can reference this table for the specific information. The custom_id refers to the
identifier from the source table, while the custom_type enum will store the table names, the values for the enum is:
paymentSources, paymentVendors, paymentMemberships, more may be added at another time.
Table name: lists
Description:
This table allows us to group data from different tables under a member defined named list. Some examples of
tables that will use this: priorities, statuses, memberFavoriteOils, memberFavoriteTestimonials, and others.
Table name: priorities
Description:
This table defines priority levels throughout the application.
Table name: statuses
Description:
This table contains all possible statuses throughout the application
Table name: faqs
Description:
This table stores commonly asked questions and the answers to them.
Testimonial Module
Table name: brandCommunications
Description:
This table allows us to set multiple emails or phone numbers for a brand. The communication_id field indicates
the email or phone id while the communication_type enum states the table the communication_id comes from, along
with a preference and priority to contact.
Table name: topicJoins
Description:
This table connects topics with all related tables in a many to many relationship so that one topic can be
associated with multiple studies, testimonials, or searches, but also that one search can be associated with multiple
topics and otherwise. Join_type enum should have the follow values: studies, testimonials, searches.
Table name: healthProductJoins
Description:
This table connects health products with all related tables. The join_type enum should have the following
values: brands, studies, testimonials.
Table name: searchResults
Description:
This table connects topics with all related tables in a many to many relationship so that one topic can be
associated with multiple studies, testimonials, or searches, but also that one search can be associated with multiple
topics and otherwise. Join_type enum should have the follow values: studies, testimonials.
Logging Module
Table name: memberLogs
Description:
This table tracks session information for members including when a member logged in, collects browser and IP
information if possible and tracks the status of the user (status active vs inactive vs logged out due to inactivity).
Table name: bounceLogs
Description:
This table stores emails that bounced or did not successfully deliver to their intended recipient, along with the
bounce type, any additional notes, and the action taken by the system (i.e. 'added email to blacklist', or 'ignored error').
Table name: emailLogs
Description:
This table tracks information about what emails were sent, whom they were sent by and to as well as subject,
body and if applicable what campaign said emails were a part of.
Table name: campaignLogs
Description:
This tracks the current status of a campaign and the start and ending times, which are given by the created_at
and deleted_at fields.
Table name: marketingSeriesLogs
Description:
This table stores the current status and the start and end times of a marketing series. We do not have a start or
end time fields on this table because that information is tracked by the created_at and deleted_at fields.
Table name: notificationMetrics
Description:
This table tracks interactions between the member and the system, if they were sent a notification, who was it
sent to and how did they respond?
Table name: responseTypes
Description:
This table tracks possible response types for interactions. Potential values include: yes, no, okay, cancel, open,
closed, agree, disagree, and others.
Table name: emailRecipientLogs
Description:
This table tracks recipients for the emailLogs table, also tracks whether or not an individual was cc'ed or bcc'ed
or if they were simply in the 'from' parameter of the email.
Table name: bounceTypes
Description:
This table contains the bounce type codes and their descriptions and will be used in determining whether or not
an email is added to a blacklist.
Table name: marketingSeriesAudits
Description:
Records data for the following tables: marketingSeries, marketingSeriesCampaigns, seriesSchedules
Table name: memberMetrics
Description:
This table works in conjunction with the members module to provide a way to track metrics for various members
module tables. Example information for this table to capture: how many emails failed to be sent to this member's email,
how many emails said member opened, when was their last login, last search, last post, how many times they have
logged in, have they received certain kinds of notifications, total questions, total referrals, total searches, total emails
sent out, last testimonials that we sent the member that matched their search criteria.
Table name: optInMetrics
Description:
This table tracks what communication medium we used to opt into a campaign. Communication_type enum
should currently be either 'phones' or 'emails'.
Table name: campaignEmailLogs
Description:
This table joins emails sent to the campaign responsible for sending them. However, we can send an email
without it being attached to a campaign, which is why this table is here and we didn't add a field to the emailLogs table.
Table name: metricTypes
Description:
Contains the key and data type of the metric we're storing, different metrics tables can contain the same keys
and same data types, but may store their own separate copy of the data itself.
Table name: campaignMetrics
Description:
This table works in conjunction with the communications module to provide a way to track metrics for various
campaign tables. Example information for this table to capture: how many times a campaign was launched, how many
people opened the communication and how many clicked on it, how many testimonials were navigated to, what other
resources were sourced as a result of the campaign, profit and cost of a campaign.
Table name: testimonialMetrics
Description:
This table works in conjunction with the testimonials module to provide a way to track metrics for various
testimonials module tables. Example information for this table to capture: which testimonial was last clicked on, which
testimonial was last advertised, how many marketing emails were sent with said testimonial referenced in them, how
many people came to the site to view a testimonial, how many times a testimonial matched search criteria, date
testimonials were approved for members to view, when testimonial was edited, when testimonial was posted to social
media.
Table name: paymentAudits
Description:
Records data for the following tables: paymentVendors, paymentMemberships, memberships,
membershipData, purchases, paymentSources, purchaseProducts, purchaseSubscriptions, purchaseSources,
paymentCustomVariables
Table name: testimonialAudits
Description:
Records data for the following tables: topics, articles, searches, searchResults, studies, testimonials,
testimonialComments, testimonialImages, sharedTestimonials
Table name: templateAudits
Description:
Records data for the following tables: templates, templateSections, templateImages, templateSchedules
Table name: memberAudits
Description:
Records data for the following tables: members, memberPreferences, phones, emails, memberProfilePictures,
memberAssignments, preferences, memberFavorites, memberShares, memberRoles, guests
Table name: brandAudits
Description:
Records data for the following tables: brands, brandCommunications, brandSocialProfiles, healthProducts
Table name: campaignAudits
Description:
Records data for the following tables: campaigns, campaignTemplates, campaignSchedules
Table name: triggerAudits
Description:
Records data for the following tables: triggers
Table name: rolePermissionAudits
Description:
Records data for the following tables: roles, rolePermissions, permissions, permissionTargets, pages, modules,
resources, functions, priorities, statuses

You might also like