--
-- Host: localhost    Database: campaigns_db
-- ------------------------------------------------------


--
-- Table structure for table `tbl_ActivationsCount`
--

CREATE TABLE `tbl_ActivationsCount` (
  `iSno` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `iActivations` int(11) NOT NULL DEFAULT '0',
  `iPostback` int(11) NOT NULL DEFAULT '0',
  `iPromotionConfigID` int(11) NOT NULL DEFAULT '0',
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`iSno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_AdvertiserConfig`
--

CREATE TABLE `tbl_AdvertiserConfig` (
  `iAdvertiserConfigID` int(11) NOT NULL AUTO_INCREMENT,
  `vcAdvertiserName` varchar(50) NOT NULL,
  `iAdvertiserOfferID` int(11) NOT NULL DEFAULT '0',
  `iOperatorID` int(11) NOT NULL,
  `iCountryID` int(11) NOT NULL DEFAULT '1',
  `iOfferTypeID` int(11) NOT NULL DEFAULT '1',
  `vcPromotionUrl` varchar(200) NOT NULL,
  `vcBannerUrl` varchar(200) NOT NULL DEFAULT '',
  `vcFlow` varchar(20) NOT NULL DEFAULT '',
  `vcAdvertiserCategory` varchar(100) NOT NULL DEFAULT '',
  `vcAdvertiserTargetOS` varchar(10) NOT NULL DEFAULT '',
  `iLimit` int(11) NOT NULL DEFAULT '0',
  `iPayout` int(6) NOT NULL DEFAULT '0',
  `iIsFullDayOffer` tinyint(1) NOT NULL DEFAULT '1',
  `vcTimeZoneOffSet` varchar(10) NOT NULL DEFAULT '',
  `iOfferStartTime` tinyint(2) NOT NULL DEFAULT '0',
  `iOfferEndTime` tinyint(2) NOT NULL DEFAULT '0',
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dtUpdatedOn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-Active,2-InActive',
  PRIMARY KEY (`iAdvertiserConfigID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Table structure for table `tbl_Countries`
--

CREATE TABLE `tbl_Countries` (
  `iCountryID` int(11) NOT NULL AUTO_INCREMENT,
  `vcCountryName` varchar(20) NOT NULL,
  `vcCountryCode` varchar(5) NOT NULL,
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-Active 2-InActive',
  PRIMARY KEY (`iCountryID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_OfferTypes`
--

CREATE TABLE `tbl_OfferTypes` (
  `iOfferTypeID` int(11) NOT NULL AUTO_INCREMENT,
  `vcOfferType` varchar(20) NOT NULL,
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-Active 2-InActive',
  PRIMARY KEY (`iOfferTypeID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_Operators`
--

CREATE TABLE `tbl_Operators` (
  `iOperatorID` int(11) NOT NULL AUTO_INCREMENT,
  `vcOperatorName` varchar(20) NOT NULL,
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-Active 2-InActive',
  PRIMARY KEY (`iOperatorID`),
  KEY `tbl_operators_idx_ioperatorid_vcoperatorname` (`iOperatorID`,`vcOperatorName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_PromotionNotifications`
--

CREATE TABLE `tbl_PromotionNotifications` (
  `iSno` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `iTransactionID` bigint(20) unsigned NOT NULL,
  `iPromotionID` bigint(20) unsigned NOT NULL,
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dtUpdatedOn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-active 2-inactive',
  PRIMARY KEY (`iSno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_Promotions`
--

CREATE TABLE `tbl_Promotions` (
  `iPromotionID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `iPromotionConfigID` int(11) NOT NULL,
  `iAdvertiserConfigID` int(11) DEFAULT NULL,
  `iTransactionID` bigint(20) unsigned NOT NULL,
  `vcClickID` varchar(100) NOT NULL,
  `vcPubID` varchar(100) NOT NULL,
  `iPayout` int(6) NOT NULL DEFAULT '0',
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dtUpdatedOn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `iStatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-initiated,1-success',
  `iPostbackStatus` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`iPromotionID`),
  KEY `iPromotionConfigID` (`iPromotionConfigID`),
  KEY `iAdvertiserConfigID` (`iAdvertiserConfigID`),
  KEY `tbl_promotions_idx_vcclickid_ipromotionid` (`vcClickID`,`iPromotionID`),
  KEY `tbl_promotions_idx_istatus_ipromotion_ipromotion` (`iStatus`,`iPromotionConfigID`,`iPromotionID`),
  KEY `tbl_promotions_idx_ipromo_iopera_dtcrea_istatu_ipostb` (`iPromotionConfigID`,`iAdvertiserConfigID`,`dtCreatedOn`,`iStatus`,`iPostbackStatus`),
  KEY `iTransactionID` (`iTransactionID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_PromotionsConfig`
--

CREATE TABLE `tbl_PromotionsConfig` (
  `iPromotionConfigID` int(11) NOT NULL AUTO_INCREMENT,
  `vcPromoterName` varchar(50) NOT NULL,
  `iAdvertiserConfigID` int(11) NOT NULL DEFAULT '0',
  `vcSourceKeyword` varchar(20) NOT NULL,
  `vcPostbackUrl` varchar(200) NOT NULL,
  `iPostbackPercentage` tinyint(4) NOT NULL,
  `iPostbackLimit` int(11) NOT NULL,
  `iPayout` int(6) NOT NULL DEFAULT '0',
  `vcTrackingKeyword` varchar(10) NOT NULL,
  `vcPubIdKeyword` varchar(10) NOT NULL,
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dtUpdatedOn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `iStatus` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-Active,2-InActive',
  PRIMARY KEY (`iPromotionConfigID`),
  UNIQUE KEY `vcSourceKeyword` (`vcSourceKeyword`),
  KEY `vcTrackingKeyword` (`vcTrackingKeyword`),
  KEY `tbl_promotionsconfig_idx_ipromotion_vcpromoter_ipostbackp` (`iPromotionConfigID`,`vcPromoterName`,`iPostbackPercentage`),
  KEY `tbl_promotionsconfig_idx_vcsour_istatu_ipromo_vctrac_vcpubi` (`vcSourceKeyword`,`iStatus`,`iPromotionConfigID`,`vcTrackingKeyword`,`vcPubIdKeyword`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_PromotionsConfig_old`
--

CREATE TABLE `tbl_Promotions_old` (
  `iPromotionID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `iPromotionConfigID` int(11) NOT NULL,
  `iAdvertiserConfigID` int(11) DEFAULT NULL,
  `iTransactionID` bigint(20) unsigned NOT NULL,
  `vcClickID` varchar(100) NOT NULL,
  `vcPubID` varchar(100) NOT NULL,
  `iPayout` int(6) NOT NULL DEFAULT '0',
  `dtCreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dtUpdatedOn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `iStatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-initiated,1-success',
  `iPostbackStatus` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`iPromotionID`),
  KEY `iPromotionConfigID` (`iPromotionConfigID`),
  KEY `iAdvertiserConfigID` (`iAdvertiserConfigID`),
  KEY `tbl_promotions_idx_vcclickid_ipromotionid` (`vcClickID`,`iPromotionID`),
  KEY `tbl_promotions_idx_istatus_ipromotion_ipromotion` (`iStatus`,`iPromotionConfigID`,`iPromotionID`),
  KEY `tbl_promotions_idx_ipromo_iopera_dtcrea_istatu_ipostb` (`iPromotionConfigID`,`iAdvertiserConfigID`,`dtCreatedOn`,`iStatus`,`iPostbackStatus`),
  KEY `iTransactionID` (`iTransactionID`)
) ENGINE=InnoDB AUTO_INCREMENT=183402 DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_reset_password`
--

CREATE TABLE `tbl_reset_password` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `email` varchar(128) NOT NULL,
  `activation_id` varchar(32) NOT NULL,
  `agent` varchar(512) NOT NULL,
  `client_ip` varchar(32) NOT NULL,
  `isDeleted` tinyint(4) NOT NULL DEFAULT '0',
  `createdBy` bigint(20) NOT NULL DEFAULT '1',
  `createdDtm` datetime NOT NULL,
  `updatedBy` bigint(20) DEFAULT NULL,
  `updatedDtm` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `tbl_roles`
--

CREATE TABLE `tbl_roles` (
  `roleId` tinyint(4) NOT NULL AUTO_INCREMENT COMMENT 'role id',
  `role` varchar(50) NOT NULL COMMENT 'role text',
  PRIMARY KEY (`roleId`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Table structure for table `tbl_users`
--

CREATE TABLE `tbl_users` (
  `userId` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(128) NOT NULL COMMENT 'login email',
  `password` varchar(128) NOT NULL COMMENT 'hashed login password',
  `name` varchar(128) DEFAULT NULL COMMENT 'full name of user',
  `mobile` varchar(20) DEFAULT NULL,
  `roleId` tinyint(4) NOT NULL,
  `isDeleted` tinyint(4) NOT NULL DEFAULT '0',
  `createdBy` int(11) NOT NULL,
  `createdDtm` datetime NOT NULL,
  `updatedBy` int(11) DEFAULT NULL,
  `updatedDtm` datetime DEFAULT NULL,
  PRIMARY KEY (`userId`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;


