Database schema

Overview

Database schema

Tables

Table emgp_acl

Not used

Table emgp_aclentry

Not used

Table emgp_balance_history

A record is created each time the account balance is adjusted via EMG Portal web interface or API.

ColumnDescription
idAuto-generated unique id (primary key)
emguser_idReference to emguser.id (account)
amount_beforeAccount balance before top-up / change
amountChange
createdTimestamp when record created
created_byReference to emgp_user.id

Table emgp_customer

Customers.

ColumnDescription
idAuto-generated unique id (primary key)
nameCustomer name (normally company)
createdTimestamp when record created
createdTimestamp when record last updated
address1Address row 1
address2Address row 2
zipZip code
cityCoty
stateState
countryCountry
phonePhone number
faxFax number
homepageHome page url
contact_adminContact person name (administrative)
email_adminContact person e-mail
contact_techContact person name (technical)
email_techContact person e-mail
orgnoCompany registration number
custnoCustomer id
email_reportE-mail address for account reports
report_enabledAccount report via e-mail enabled

Table emgp_emgaccount

Links emguser entries to a customer.

ColumnDescription
idAuto-generated unique id (primary key)
emguser_idReference to emguser.id
customer_idReference to customer.id

Table emgp_hourly_summary

Aggregated data for sent messages per account and hour.

Table is populated by “hourly_summary.pl” script which should be run by cron every minute.

There is a unique index for the column combination `username`, `time`, `prefix`, `charge` meaning there may be multiple entries for same prefix and hour if the price has changed.

Number of failed messages can be calculated from `msgcount` – `msg_count_ok` – `msg_count_relayed`.

ColumnDescription
idAuto-generated unique id (primary key)
usernameemguser.username (account)
timeDatetime (hour resolution), “2016-01-12 09”
prefixPrefix (as given by matching price entry)
chargeCharge (as given by matching price entry)
charge_costCharge cost (as given by matching price entry)
charge_price_idemgp_price.id for matching “charge” entry
charge_cost_price_idemgp_price.id for matching “charge_cost” entry
msg_countTotal message count
msg_count_okNumber of messages with status “ok”
msg_count_relayedNumber of messages with status “relayed”

Table emgp_job

Send jobs created via EMG Portal “send” page.

ColumnDescription
idAuto-generated unique id (primary key)
user_idUser that created job. Reference to user.id
send_atDate and time when job should be sent. Send immediately = null.
createdTimestamp when record created
updatedTimestamp when record last updated
messagebodyMessage body
started_atTimestamp when sending of job started
finished_atTimestamp when sending of job finished

Table emgp_jobrecipient

Send job recipients.

ColumnDescription
ColumnDescription
idAuto-generated unique id (primary key)
statusJob recipient status
senderrorEMG status
msgidReference to routelog.msgid
createdTimestamp when record created
updatedTimestamp when record last updated
companyRecipient company
nameRecipient name
destaddrRecipient number (destination address)
job_idReference to emgp_job.id
var1Variable data field 1
var2Variable data field 2
var3Variable data field 3
var4Variable data field 4
var5Variable data field 5

Table emgp_pb

Phone books.

Table emgp_pbentry

Phone book entries.

Table emgp_price

Price entries.

Table emgp_route

Route entries.

Table emgp_settings

Settings.

Table emgp_user

Web users.