DONATE:MySQL Tables

-- - -- Table `Donate`.`eventType` -- - DROP TABLE IF EXISTS `Donate`.`eventType` ;

CREATE TABLE IF NOT EXISTS `Donate`.`eventType` (

`eventTypeID` INT NOT NULL, `eventName` VARCHAR(50) NOT NULL , `eventDescription` VARCHAR(200) NULL , PRIMARY KEY (eventTypeID)) ENGINE = InnoDB;

-- - -- Table `Donate`.`donor` -- - DROP TABLE IF EXISTS `Donate`.`donor` ;

CREATE TABLE IF NOT EXISTS `Donate`.`donor` (  `donorID` INT NOT NULL AUTO_INCREMENT,  `street` VARCHAR(25) NULL ,  `city` VARCHAR(20) NULL ,  `state` VARCHAR(2) NULL ,  `zip` VARCHAR(10) NULL ,  `phone` VARCHAR(14) NULL ,  `fax` VARCHAR(14) NULL ,  `eMail` VARCHAR(30) NULL ,  PRIMARY KEY (`donorID`) ) ENGINE = InnoDB;

-- - -- Table `Donate`.`donation` -- - DROP TABLE IF EXISTS `Donate`.`donation` ;

CREATE TABLE IF NOT EXISTS `Donate`.`donation` (  `donationID` INT NOT NULL AUTO_INCREMENT,  `donationDate` DATE NOT NULL ,  `donorID` INT NULL ,  `eventID` INT NULL ,  PRIMARY KEY (donation) ,  INDEX (donorID) ,    FOREIGN KEY (donorID)    REFERENCES donor (donorID)    ON DELETE NO ACTION    ON UPDATE NO ACTION,	INDEX (eventID) ,    FOREIGN KEY (eventID)    REFERENCES event(eventID)    ON DELETE NO ACTION    ON UPDATE NO ACTION) ENGINE = InnoDB;

-- - -- Table `Donate`.`event` -- - DROP TABLE IF EXISTS `Donate`.`event` ;

CREATE TABLE IF NOT EXISTS `Donate`.`event` (  `eventID` INT NOT NULL AUTO_INCREMENT,  `eventTypeID` INT NOT NULL ,  `eventDate` DATE NULL ,  `street` VARCHAR(25) NULL ,  `city` VARCHAR(15) NULL ,  `state` VARCHAR(2) NULL ,  `zip` VARCHAR(10) NULL ,  PRIMARY KEY (`eventID`)  INDEX (eventTypeID) ,    FOREIGN KEY (eventTypeID)    REFERENCES eventType(eventTypeID)    ON DELETE NO ACTION    ON UPDATE NO ACTION) ENGINE = InnoDB;

-- - -- Table `Donate`.`individual` -- - DROP TABLE IF EXISTS `Donate`.`individual` ;

CREATE TABLE IF NOT EXISTS `Donate`.`individual` (  `donorID` INT NOT NULL,  `firstName` VARCHAR(20) NULL ,  `lastName` VARCHAR(20) NULL ,  PRIMARY KEY (donorID) ,  INDEX (donorID) ,    FOREIGN KEY (donorID)    REFERENCES donor(donorID)    ON DELETE NO ACTION    ON UPDATE NO ACTION) ENGINE = InnoDB;

-- - -- Table `Donate`.`organization` -- - DROP TABLE IF EXISTS `Donate`.`organization` ;

CREATE TABLE IF NOT EXISTS `Donate`.`organization` (  `donorID` INT NOT NULL,  `organizationName` VARCHAR(100) NULL ,  `description` VARCHAR(100) NULL ,  PRIMARY KEY (donorID) ,  INDEX (donorID) ,    FOREIGN KEY (donorID)    REFERENCES donor (donorID)    ON DELETE NO ACTION    ON UPDATE NO ACTION) ENGINE = InnoDB;

SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;