Lowercase database columns names

This commit is contained in:
Dmitriy Simushev 2014-07-11 13:00:11 +00:00
parent bdd7d31bd5
commit f33c686aab
4 changed files with 22 additions and 22 deletions

View File

@ -25,13 +25,13 @@ chatthread:
# ID of the thread. # ID of the thread.
threadid: "int NOT NULL auto_increment PRIMARY KEY" threadid: "int NOT NULL auto_increment PRIMARY KEY"
# Name of the user in chat. # Name of the user in chat.
userName: "varchar(64) NOT NULL" username: "varchar(64) NOT NULL"
# ID of the user. This field is foreign key for {chatsitevisitor}.userid # ID of the user. This field is foreign key for {chatsitevisitor}.userid
userid: "varchar(255)" userid: "varchar(255)"
# Name of the operator who took place in the chat. # Name of the operator who took place in the chat.
agentName: "varchar(64)" agentname: "varchar(64)"
# ID of the operator who took place in the chat. # ID of the operator who took place in the chat.
agentId: "int NOT NULL DEFAULT 0" agentid: "int NOT NULL DEFAULT 0"
# Unix timestamp of the moment when the thread was created. # Unix timestamp of the moment when the thread was created.
dtmcreated: "int NOT NULL DEFAULT 0" dtmcreated: "int NOT NULL DEFAULT 0"
# Unix timestamp of the moment when chat actually started. # Unix timestamp of the moment when chat actually started.
@ -62,15 +62,15 @@ chatthread:
# Unix timestamp of the last request from operator's window to server. # Unix timestamp of the last request from operator's window to server.
lastpingagent: "int NOT NULL DEFAULT 0" lastpingagent: "int NOT NULL DEFAULT 0"
# Indicates if user typing or not. It can take two values 0 and 1. # Indicates if user typing or not. It can take two values 0 and 1.
userTyping: "int DEFAULT 0" usertyping: "int DEFAULT 0"
# Indicates if operator typing or not. It can take two values 0 and 1. # Indicates if operator typing or not. It can take two values 0 and 1.
agentTyping: "int DEFAULT 0" agenttyping: "int DEFAULT 0"
# ID of shown message in the chat. # ID of shown message in the chat.
shownmessageid: "int NOT NULL DEFAULT 0" shownmessageid: "int NOT NULL DEFAULT 0"
# User agent description that took from 'User-Agent' HTTP header. # User agent description that took from 'User-Agent' HTTP header.
userAgent: "varchar(255)" useragent: "varchar(255)"
# Total count of user's messages related with the thread. # Total count of user's messages related with the thread.
messageCount: "varchar(16)" messagecount: "varchar(16)"
# ID of the group at Mibew side related with the thread. # ID of the group at Mibew side related with the thread.
groupid: "int references {chatgroup}(groupid)" groupid: "int references {chatgroup}(groupid)"
@ -152,7 +152,7 @@ chatmessage:
ikind: "int NOT NULL" ikind: "int NOT NULL"
# ID of operator who sent the message. This value will be ignored for # ID of operator who sent the message. This value will be ignored for
# system messages and messages which sent by users. # system messages and messages which sent by users.
agentId: "int NOT NULL DEFAULT 0" agentid: "int NOT NULL DEFAULT 0"
# Message text body. # Message text body.
tmessage: "text NOT NULL" tmessage: "text NOT NULL"
# Name of the plugin which sent the message. If message was not sent by # Name of the plugin which sent the message. If message was not sent by
@ -226,7 +226,7 @@ chatban:
dtmtill: "int NOT NULL DEFAULT 0" dtmtill: "int NOT NULL DEFAULT 0"
address: "varchar(255)" address: "varchar(255)"
comment: "varchar(255)" comment: "varchar(255)"
blockedCount: "int DEFAULT 0" blockedcount: "int DEFAULT 0"
# Contains dynamic configs # Contains dynamic configs
chatconfig: chatconfig:

View File

@ -81,10 +81,10 @@ class HistoryController extends AbstractController
} }
} }
if ($search_type == 'operator' || $search_type == 'all') { if ($search_type == 'operator' || $search_type == 'all') {
$search_conditions[] = "({chatthread}.agentName LIKE :query)"; $search_conditions[] = "({chatthread}.agentname LIKE :query)";
} }
if ($search_type == 'visitor' || $search_type == 'all') { if ($search_type == 'visitor' || $search_type == 'all') {
$search_conditions[] = "({chatthread}.userName LIKE :query)"; $search_conditions[] = "({chatthread}.username LIKE :query)";
$search_conditions[] = "({chatthread}.remote LIKE :query)"; $search_conditions[] = "({chatthread}.remote LIKE :query)";
} }

View File

@ -178,23 +178,23 @@ class Thread
'nextAgent' => 'nextagent', 'nextAgent' => 'nextagent',
'groupId' => 'groupid', 'groupId' => 'groupid',
'shownMessageId' => 'shownmessageid', 'shownMessageId' => 'shownmessageid',
'messageCount' => 'messageCount', 'messageCount' => 'messagecount',
'created' => 'dtmcreated', 'created' => 'dtmcreated',
'modified' => 'dtmmodified', 'modified' => 'dtmmodified',
'chatStarted' => 'dtmchatstarted', 'chatStarted' => 'dtmchatstarted',
'closed' => 'dtmclosed', 'closed' => 'dtmclosed',
'agentId' => 'agentId', 'agentId' => 'agentid',
'agentName' => 'agentName', 'agentName' => 'agentname',
'agentTyping' => 'agentTyping', 'agentTyping' => 'agenttyping',
'lastPingAgent' => 'lastpingagent', 'lastPingAgent' => 'lastpingagent',
'locale' => 'locale', 'locale' => 'locale',
'userId' => 'userid', 'userId' => 'userid',
'userName' => 'userName', 'userName' => 'username',
'userTyping' => 'userTyping', 'userTyping' => 'usertyping',
'lastPingUser' => 'lastpinguser', 'lastPingUser' => 'lastpinguser',
'remote' => 'remote', 'remote' => 'remote',
'referer' => 'referer', 'referer' => 'referer',
'userAgent' => 'userAgent', 'userAgent' => 'useragent',
); );
/** /**
@ -1077,7 +1077,7 @@ class Thread
// Prepare query // Prepare query
$query = "INSERT INTO {chatmessage} (" $query = "INSERT INTO {chatmessage} ("
. "threadid, ikind, tmessage, tname, agentId, " . "threadid, ikind, tmessage, tname, agentid, "
. "dtmcreated, plugin, data" . "dtmcreated, plugin, data"
. ") VALUES (" . ") VALUES ("
. ":threadid, :kind, :message, :name, :agentid, " . ":threadid, :kind, :message, :name, :agentid, "

View File

@ -420,7 +420,7 @@ function calculate_operator_statistics()
// Get base operator's info // Get base operator's info
$db_results = $db->query( $db_results = $db->query(
("SELECT (FLOOR(m.dtmcreated / :interval) * :interval) AS date, " ("SELECT (FLOOR(m.dtmcreated / :interval) * :interval) AS date, "
. "m.agentId AS operator_id, " . "m.agentid AS operator_id, "
. "COUNT(distinct m.threadid) AS threads, " . "COUNT(distinct m.threadid) AS threads, "
. "COUNT(m.messageid) AS messages, " . "COUNT(m.messageid) AS messages, "
. "AVG(CHAR_LENGTH(m.tmessage)) AS avg_msg_length " . "AVG(CHAR_LENGTH(m.tmessage)) AS avg_msg_length "
@ -459,7 +459,7 @@ function calculate_operator_statistics()
// Get info about invitations // Get info about invitations
$db_results = $db->query( $db_results = $db->query(
("SELECT (FLOOR(dtmcreated / :interval) * :interval) AS date, " ("SELECT (FLOOR(dtmcreated / :interval) * :interval) AS date, "
. "agentId AS operator_id, " . "agentid AS operator_id, "
. "COUNT(threadid) AS invitations_sent, " . "COUNT(threadid) AS invitations_sent, "
. "SUM(invitationstate = :invitation_accepted) AS invitations_accepted, " . "SUM(invitationstate = :invitation_accepted) AS invitations_accepted, "
. "SUM(invitationstate = :invitation_rejected) AS invitations_rejected, " . "SUM(invitationstate = :invitation_rejected) AS invitations_rejected, "
@ -470,7 +470,7 @@ function calculate_operator_statistics()
// statistics_aggregation_interval // statistics_aggregation_interval
. "AND (:today - dtmcreated) > :interval " . "AND (:today - dtmcreated) > :interval "
// Check if thread has related operator // Check if thread has related operator
. "AND agentId != 0 " . "AND agentid != 0 "
// Ignore not accepted invitations // Ignore not accepted invitations
. "AND (invitationstate = :invitation_accepted " . "AND (invitationstate = :invitation_accepted "
. "OR invitationstate = :invitation_rejected " . "OR invitationstate = :invitation_rejected "