--
-- Host: localhost    Database: cdc_crm
-- ------------------------------------------------------


--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `id` int(5) NOT NULL DEFAULT '0',
  `firstname` varchar(10) DEFAULT NULL,
  `name` varchar(10) DEFAULT NULL,
  `age` int(3) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` VALUES (2,'Ost','Ed',1),(3,'Theodore','Monroe',20),(4,'Martin','Grant',50),(5,'Ulysses','Lincoln',69),(6,'Richard','Harding',84),(7,'Ronald','Van Buren',99),(8,'Calvin','Hoover',89),(9,'James','Jefferson',13),(10,'Lyndon','Jackson',89),(11,'Nuno','FRANCISCO',31);
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`tadmin`@`localhost`*/ /*!50003 TRIGGER `cdc_crm`.`TCDC_TG_customers_I` 
 AFTER INSERT ON  `cdc_crm`.`customers`
 FOR each row 
 INSERT INTO `cdc_monitor`.`TCDC_customers` 
  ( 
   `TALEND_CDC_SUBSCRIBERS_NAME`,
   `TALEND_CDC_STATE`,
   `TALEND_CDC_TYPE`,
   `TALEND_CDC_CREATION_DATE`,
   `id`
  ) SELECT 
     `TALEND_CDC_SUBSCRIBER_NAME`,
     '0',
     'I',
     sysdate(),
     new.`id`      
    FROM `cdc_monitor`.`TSUBSCRIBERS`
    WHERE `TALEND_CDC_TABLE_TO_WATCH`='cdc_crm.customers' */;;
DELIMITER ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`tadmin`@`localhost`*/ /*!50003 TRIGGER `cdc_crm`.`TCDC_TG_customers_U` 
 AFTER UPDATE ON `cdc_crm`.`customers`
 FOR each row 
 INSERT INTO `cdc_monitor`.`TCDC_customers` 
  ( 
   `TALEND_CDC_SUBSCRIBERS_NAME`,
   `TALEND_CDC_STATE`,
   `TALEND_CDC_TYPE`,
   `TALEND_CDC_CREATION_DATE`,
   `id`
  ) SELECT 
     `TALEND_CDC_SUBSCRIBER_NAME`,
     '0',
     'U',
     sysdate(),
     new.`id`
    FROM `cdc_monitor`.`TSUBSCRIBERS`
    WHERE `TALEND_CDC_TABLE_TO_WATCH`='cdc_crm.customers' */;;
DELIMITER ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`tadmin`@`localhost`*/ /*!50003 TRIGGER `cdc_crm`.`TCDC_TG_customers_D` 
 AFTER DELETE ON  `cdc_crm`.`customers`
 FOR each row 
 INSERT INTO `cdc_monitor`.`TCDC_customers` 
  ( 
   `TALEND_CDC_SUBSCRIBERS_NAME`,
   `TALEND_CDC_STATE`,
   `TALEND_CDC_TYPE`,
   `TALEND_CDC_CREATION_DATE`,
   `id`
  ) SELECT 
     `TALEND_CDC_SUBSCRIBER_NAME`,
     '0',
     'D',
     sysdate(),
     old.`id` 
    FROM `cdc_monitor`.`TSUBSCRIBERS`
    WHERE `TALEND_CDC_TABLE_TO_WATCH`='cdc_crm.customers' */;;
DELIMITER ;


