DROP TABLE IF EXISTS `EasyIndex_admin`;
CREATE TABLE IF NOT EXISTS `EasyIndex_admin` (
  `vLicenceKey` varchar(250) NOT NULL default '',
  `nAdminId` bigint(20) unsigned NOT NULL auto_increment,
  `vAdminFname` varchar(25) NOT NULL default '',
  `vAdminLastname` varchar(25) default NULL,
  `vAdminEmail` varchar(100) NOT NULL default '',
  `vAdminUsername` varchar(20) NOT NULL default '',
  `vAdminPassword` varchar(100) NOT NULL default '',
  `eAdminActive` enum('1','0') default '1',
  PRIMARY KEY  (`nAdminId`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
DROP TABLE IF EXISTS `EasyIndex_category`;
CREATE TABLE IF NOT EXISTS `EasyIndex_category` (
  `nCategoryId` int(11) NOT NULL auto_increment,
  `vCategoryDesc` varchar(100) default NULL,
  `nParentId` int(11) NOT NULL default '0',
  `vRoute` int(11) default NULL,
  `nCount` int(11) default '0',
  PRIMARY KEY  (`nCategoryId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_enquiry`;
CREATE TABLE IF NOT EXISTS `EasyIndex_enquiry` (
  `nId` int(5) NOT NULL auto_increment,
  `nProductId` int(11) NOT NULL,
  `vTitle` varchar(255) NOT NULL,
  `vDescription` text NOT NULL,
  `dDate` date NOT NULL,
  `vPostedBy` varchar(255) NOT NULL,
  `vEmail` varchar(255) NOT NULL,
  `nStatus` int(1) NOT NULL default '0',
  PRIMARY KEY  (`nId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_payments`;
CREATE TABLE IF NOT EXISTS `EasyIndex_payments` (
  `nPaymentId` int(11) NOT NULL auto_increment,
  `nListId` int(11) NOT NULL,
  `vUserFirstName` varchar(255) NOT NULL,
  `vUserLastName` varchar(255) NOT NULL,
  `vAmount` float NOT NULL,
  `vProductName` varchar(255) NOT NULL,
  `dDate` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `vPaymentStatus` enum('P','C') NOT NULL default 'P',
  `vTransactionId` varchar(255) NOT NULL,
  PRIMARY KEY  (`nPaymentId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_product`;
CREATE TABLE IF NOT EXISTS `EasyIndex_product` (
  `nBusId` bigint(20) unsigned NOT NULL auto_increment,
  `nUserId` bigint(20) NOT NULL default '0',
  `nCatid` bigint(20) NOT NULL default '0',
  `dPostDate` date default NULL,
  `nStatus` int(11) NOT NULL default '0',
  `nFeatured` int(11) NOT NULL default '0',
  `maxSearches` bigint(20) default NULL,
  `Title` text,
  `Description` text,
  `Image` text,
  `Video` text,
  `VideoURL` text,
  `Zipcode` text,
  `Address` text,
  `Country` varchar(250) default NULL,
  PRIMARY KEY  (`nBusId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_productcomment`;
CREATE TABLE IF NOT EXISTS `EasyIndex_productcomment` (
  `nId` int(5) NOT NULL auto_increment,
  `nProductId` int(4) NOT NULL,
  `vComment` text NOT NULL,
  `vName` varchar(150) NOT NULL,
  `vEmail` varchar(150) NOT NULL,
  `dDate` date NOT NULL,
  `nStatus` int(1) NOT NULL,
  PRIMARY KEY  (`nId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_productdesc`;
CREATE TABLE IF NOT EXISTS `EasyIndex_productdesc` (
  `id` bigint(20) NOT NULL auto_increment,
  `vFldname` varchar(100) default NULL,
  `vFlddesc` varchar(100) default NULL,
  `vFldType` varchar(100) default NULL,
  `vFldSize` varchar(100) default NULL,
  `vFldSearch` varchar(100) default NULL,
  `vInType` varchar(100) default NULL,
  `vlink` smallint(6) default '0',
  `nMandatory` int(11) NOT NULL default '0',
  `nEditable` int(11) NOT NULL default '0',
  `nStatus` int(11) NOT NULL default '0',
  `nRemovable` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
DROP TABLE IF EXISTS `EasyIndex_productrating`;
CREATE TABLE IF NOT EXISTS `EasyIndex_productrating` (
  `nId` int(5) NOT NULL auto_increment,
  `nProductId` int(4) NOT NULL,
  `nRate` int(2) NOT NULL,
  `dDate` date NOT NULL,
  `nStatus` int(1) NOT NULL,
  PRIMARY KEY  (`nId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_settings`;
CREATE TABLE IF NOT EXISTS `EasyIndex_settings` (
  `settingfield` varchar(250) NOT NULL,
  `value` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `EasyIndex_statistics`;
CREATE TABLE IF NOT EXISTS `EasyIndex_statistics` (
  `nId` int(11) NOT NULL auto_increment,
  `nCount` text,
  `dTrackingDate` timestamp NULL default NULL,
  PRIMARY KEY  (`nId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_users`;
CREATE TABLE IF NOT EXISTS `EasyIndex_users` (
  `nUserId` int(11) NOT NULL auto_increment,
  `vLoginName` varchar(100) default NULL,
  `vPassword` varchar(100) default NULL,
  `vFirstName` varchar(100) default NULL,
  `vLastName` varchar(100) default NULL,
  `vAddress1` varchar(100) default NULL,
  `vAddress2` varchar(100) default NULL,
  `vCity` varchar(100) default NULL,
  `vState` varchar(100) default NULL,
  `vCountry` varchar(100) default NULL,
  `nZip` int(11) default NULL,
  `vPhone` varchar(50) default NULL,
  `vFax` varchar(50) default NULL,
  `vEmail` varchar(100) default NULL,
  `vUrl` varchar(100) default NULL,
  `vGender` varchar(10) default NULL,
  `vEducation` varchar(50) default NULL,
  `vDescription` text,
  `dDateReg` datetime default NULL,
  `vAlertStatus` char(1) default 'N',
  `vNLStatus` char(1) default 'N',
  `vStatus` varchar(10) default '0',
  `vDelStatus` varchar(10) default '0',
  `nSocialUserId` varchar(250) default NULL,
  PRIMARY KEY  (`nUserId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `EasyIndex_plans`;
CREATE TABLE `EasyIndex_plans` ( `nPlanId` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`vPlanName` VARCHAR( 250 ) NOT NULL ,
`vPlanAmount` FLOAT NOT NULL ,
`vPlantype` ENUM( 'O', 'M' ) NOT NULL COMMENT 'O-One time,M-Monthly',
`vPlanDuration` BIGINT NOT NULL ,
`vPlanStatus` ENUM( 'E', 'D' ) NOT NULL DEFAULT 'E',
`dPlaneDate` DATE NOT NULL ) ENGINE = MYISAM ;

ALTER TABLE `EasyIndex_product` ADD `nPaymentStatus` ENUM( 'P', 'N', 'O' ) NOT NULL DEFAULT 'P' COMMENT 'P-paid,N- not paid,O-one timepayment';

ALTER TABLE `EasyIndex_payments` ADD `vPaymentType` ENUM( 'F', 'L' ) NOT NULL DEFAULT 'F' COMMENT 'F-featured,L-listing';

ALTER TABLE `EasyIndex_product` ADD `nPlanId` BIGINT NOT NULL;
DROP TABLE IF EXISTS `EasyIndex_cms`;
CREATE TABLE `EasyIndex_cms` (
`nContentId` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`vTitle` VARCHAR( 255 ) NOT NULL ,
`vDescription` TEXT NOT NULL ,
`dCreatedDate` DATE NOT NULL ,
`nStatus` TINYINT NOT NULL
) ENGINE = MYISAM ;

RENAME TABLE `clients_easyindexnew`.`tbl_zipcode` TO `clients_easyindexnew`.`EasyIndex_tbl_zipcode` ;
ALTER TABLE `EasyIndex_product` ADD `nPlanExpiryDate` DATE NOT NULL AFTER `nPaymentStatus`;
DROP TABLE IF EXISTS `EasyIndex_tbl_zipcode`;
CREATE TABLE IF NOT EXISTS `EasyIndex_tbl_zipcode` (
  `zipid` bigint(20) NOT NULL auto_increment,
  `zipcode` varchar(10) NOT NULL default '',
  `statecode` varchar(5) NOT NULL default '',
  `latitude` varchar(50) NOT NULL default '',
  `longitude` varchar(50) NOT NULL default '',
  `city` varchar(50) NOT NULL default '',
  `state` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`zipid`),
  KEY `ZIPCODE` (`zipcode`),
  KEY `STATECODE` (`statecode`),
  KEY `STATE` (`state`),
  KEY `CITY` (`city`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `EasyIndex_product` ADD `nParentCatId` BIGINT( 11 ) NOT NULL COMMENT 'Parent category Id' AFTER `nUserId`;
ALTER TABLE `EasyIndex_payments` CHANGE `vPaymentType` `vPaymentType` ENUM( 'F', 'L', 'R' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'F' COMMENT 'F-featured,L-listing,R-Renewal';
CREATE TABLE IF NOT EXISTS `EasyIndex_metadata` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`keyword` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `EasyIndex_product` ADD `alias` VARCHAR( 250 ) NOT NULL AFTER `nPlanId`;