-- Create Table Statement for 'Email'
DROP TABLE IF EXISTS `EMAIL`;
CREATE TABLE `EMAIL` (
	ID bigint(20) NOT NULL,
	REF_CODE varchar,
	CREATE_DATE datetime,
	DUE_DATE datetime,
	TEMPLATE_CODE varchar,
	STATUS_CL varchar,
	MERCHANT_ACCOUNT_CODE int(11) NOT NULL,
	COLLECTOR_ACCOUNT_CODE int(11),
	CREATOR_CODE varchar,
	FIRST_NAME varchar,
	LAST_NAME varchar,
	TO_EMAIL varchar,
	SUBJECT varchar,
	MESSAGE varchar,
	BALANCE_PHASE1 int(11),
	BALANCE_PHASE2 int(11),
	BALANCE_PHASE3 int(11),
	BALANCE_PHASE4 int(11),
	ATTACHMENT_CODE bigint(20),
	FILE_EXTENTION varchar,
	IS_VISIBLE_EXTERNALLY tinyint(1),
	RESPONSE varchar,
	PROCESSED_DATE datetime,
	EMAIL_CODE_FK bigint(20),
	ACCOUNT_TRANSACTION_FK bigint(20),
	CUSTOMER_ACCOUNT_FK bigint(20),
	PAYMENT_PLAN_FK bigint(20),
	PAYMENT_OPTION_FK bigint(20),
	EMAILING_HISTORY_FK bigint(20),
	EMAIL_ADDRESS_FK bigint(20),
	PRIMARY KEY (ID)
) ENGINE=InnoDB;