CREATE TABLE IF NOT EXISTS `CrmProspect` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`FirstName` TEXT  NOT NULL,
`LastName` TEXT  NOT NULL,
`Email` TEXT  NULL,
`Phone` TEXT  NULL,
`Adress` TEXT NULL,
`DateMeet` DATE NULL,
`PlaceMeet` TEXT NULL,
`Type` TEXT NULL,
`Description` TEXT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `CrmBusinessType` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` TEXT  NOT NULL,
`Description` TEXT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `CrmProspectType` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` VARCHAR(200)  NOT NULL,
`Description` TEXT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `CrmBusinessStatut` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` VARCHAR(200)  NOT NULL,
`Description` TEXT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `CrmBusiness` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` VARCHAR(200)  NOT NULL,
`Code` VARCHAR(200)  NOT NULL,
`Description` TEXT  NOT NULL,
`TypeId` INT  NOT NULL,
`StatutId` INT  NOT NULL,
`ProspectId` INT  NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `CrmBusinessType_CrmBusiness` FOREIGN KEY (`TypeId`) REFERENCES `CrmBusinessType`(`Id`),
CONSTRAINT `CrmBusinessStatut_CrmBusiness` FOREIGN KEY (`StatutId`) REFERENCES `CrmBusinessStatut`(`Id`),
CONSTRAINT `CrmProspect_CrmBusiness` FOREIGN KEY (`ProspectId`) REFERENCES `CrmProspect`(`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `CrmProspectCalledBack` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`ProspectId` INT  NOT NULL,
`DateCall` TEXT  NOT NULL,
`HourCall` TEXT  NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `CrmProspect_CrmProspectCalledBack` FOREIGN KEY (`ProspectId`) REFERENCES `CrmProspect`(`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 