Index: branches/5.1.x/core/install/upgrades.sql
===================================================================
diff -u -r13368 -r13390
--- branches/5.1.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 13368)
+++ branches/5.1.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 13390)
@@ -1710,4 +1710,88 @@
 	cv.GroupDisplayOrder = (SELECT ca7.GroupDisplayOrder FROM <%TABLE_PREFIX%>ConfigurationAdmin ca7 WHERE ca7.VariableName = cv.VariableName),
 	cv.`Install` = (SELECT ca8.`Install` FROM <%TABLE_PREFIX%>ConfigurationAdmin ca8 WHERE ca8.VariableName = cv.VariableName);
 
-DROP TABLE ConfigurationAdmin;
\ No newline at end of file
+DROP TABLE ConfigurationAdmin;
+
+ALTER TABLE Forms
+	ADD RequireLogin TINYINT NOT NULL DEFAULT '0',
+	ADD INDEX (RequireLogin),
+	ADD UseSecurityImage TINYINT NOT NULL DEFAULT '0',
+	ADD INDEX (UseSecurityImage),
+	ADD EnableEmailCommunication TINYINT NOT NULL DEFAULT '0',
+	ADD INDEX (EnableEmailCommunication),
+	ADD ReplyFromName VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyFromEmail VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyCc VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyBcc VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyMessageSignature TEXT,
+	ADD ReplyServer VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyPort INT(10) NOT NULL DEFAULT '110',
+	ADD ReplyUsername VARCHAR(255) NOT NULL DEFAULT '',
+	ADD ReplyPassword VARCHAR(255) NOT NULL DEFAULT ''
+	ADD BounceEmail VARCHAR(255) NOT NULL DEFAULT '',
+	ADD BounceServer VARCHAR(255) NOT NULL DEFAULT '',
+	ADD BouncePort INT(10) NOT NULL DEFAULT '110',
+	ADD BounceUsername VARCHAR(255) NOT NULL DEFAULT '',
+	ADD BouncePassword VARCHAR(255) NOT NULL DEFAULT '';
+
+ALTER TABLE FormFields
+	ADD Visibility TINYINT NOT NULL DEFAULT '1',
+	ADD INDEX (Visibility),
+	ADD EmailCommunicationRole TINYINT NOT NULL DEFAULT '0',
+	ADD INDEX (EmailCommunicationRole);
+
+ALTER TABLE FormSubmissions
+	ADD IPAddress VARCHAR(15) NOT NULL DEFAULT '' AFTER SubmissionTime,
+	ADD ReferrerURL VARCHAR(255) NOT NULL DEFAULT '' AFTER IPAddress,
+	ADD LogStatus TINYINT UNSIGNED NOT NULL DEFAULT '2' AFTER ReferrerURL,
+	ADD LastUpdatedOn INT UNSIGNED NULL AFTER LogStatus,
+	ADD Notes TEXT NULL AFTER LastUpdatedOn,
+	ADD INDEX (LogStatus),
+	ADD INDEX (LastUpdatedOn);
+
+CREATE TABLE SubmissionLog (
+  SubmissionLogId int(11) NOT NULL AUTO_INCREMENT,
+  FormSubmissionId int(10) unsigned NOT NULL,
+  FromEmail varchar(255) NOT NULL DEFAULT '',
+  ToEmail varchar(255) NOT NULL DEFAULT '',
+  Cc text,
+  Bcc text,
+  `Subject` varchar(255) NOT NULL DEFAULT '',
+  Message text,
+  Attachment text,
+  ReplyStatus tinyint(3) unsigned NOT NULL DEFAULT '0',
+  SentStatus tinyint(3) unsigned NOT NULL DEFAULT '0',
+  SentOn int(10) unsigned DEFAULT NULL,
+  RepliedOn int(10) unsigned DEFAULT NULL,
+  VerifyCode varchar(32) NOT NULL DEFAULT '',
+  DraftId int(10) unsigned NOT NULL DEFAULT '0',
+  MessageId varchar(255) NOT NULL DEFAULT '',
+  BounceInfo text,
+  BounceDate int(11) DEFAULT NULL,
+  PRIMARY KEY (SubmissionLogId),
+  KEY FormSubmissionId (FormSubmissionId),
+  KEY ReplyStatus (ReplyStatus),
+  KEY SentStatus (SentStatus),
+  KEY SentOn (SentOn),
+  KEY RepliedOn (RepliedOn),
+  KEY VerifyCode (VerifyCode),
+  KEY DraftId (DraftId),
+  KEY BounceDate (BounceDate),
+  KEY MessageId (MessageId)
+);
+
+CREATE TABLE Drafts (
+  DraftId int(11) NOT NULL AUTO_INCREMENT,
+  FormSubmissionId int(10) unsigned NOT NULL DEFAULT '0',
+  CreatedOn int(10) unsigned DEFAULT NULL,
+  CreatedById int(11) NOT NULL,
+  Message text,
+  PRIMARY KEY (DraftId),
+  KEY FormSubmissionId (FormSubmissionId),
+  KEY CreatedOn (CreatedOn),
+  KEY CreatedById (CreatedById)
+);
+
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.TO.USER', NULL, 1, 0, NULL, 'Core:Category', 'Admin Reply to User Form Submission', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER', NULL, 1, 0, NULL, 'Core:Category', 'User Replied to It\'s Form Submission', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER.BOUNCED', NULL, 1, 0, NULL, 'Core:Category', 'Form Submission Admin Reply Delivery Failure', 1);
\ No newline at end of file
