 DROP TABLE user_tasks;
 DROP TABLE booked_events;
 DROP TABLE system_events;
-DROP TABLE system_map_markers;
 DROP TABLE user_messages_lookup;
 DROP TABLE user_messages;
 DROP TABLE paypal_log;

REFERENCES user_signin(userid)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE = InnoDB;
	`updated_on` DATETIME,
	`completed_on` DATETIME,
	`cancelled_on` DATETIME,
FOREIGN KEY (userid)
REFERENCES user_signin(userid)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE = InnoDB;

#Messenger
CREATE TABLE `student_portal`.`user_messages` (
	`messageid` INT(11) NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
	`message_subject` VARCHAR(300) NOT NULL,
	`message_body` VARCHAR(5000),
	`created_on` DATETIME NOT NULL
) ENGINE = InnoDB;

#Messenger
CREATE TABLE `student_portal`.`user_messages_lookup` (
  `messageid` INT(11) NOT NULL AUTO_INCREMENT,
  `message_from` INT(11) NOT NULL,
  `message_to` INT(11) NOT NULL,
  `isRead` TINYINT(1) NOT NULL,
FOREIGN KEY (messageid)
REFERENCES user_messages(messageid),
FOREIGN KEY (message_from)
REFERENCES user_signin(userid),
FOREIGN KEY (message_to)
REFERENCES user_signin(userid)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE = InnoDB;

#Events
CREATE TABLE `student_portal`.`system_events` (
	`eventid` INT(11) NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
	`event_name` VARCHAR(300) NOT NULL,
	`event_notes` VARCHAR(5000),
	`event_url` VARCHAR(70),
	`event_class` VARCHAR(15) NOT NULL,
	`event_from` DATETIME NOT NULL,
	`event_to` DATETIME NOT NULL,
	`event_amount` NUMERIC(15,2) NOT NULL,
	`event_ticket_no` INT(11) NOT NULL,
	`event_category` VARCHAR(10) NOT NULL,
	`event_status` VARCHAR(10) NOT NULL,
	`created_on` DATETIME NOT NULL,
	`updated_on` DATETIME
) ENGINE = InnoDB;

#Events
CREATE TABLE `student_portal`.`booked_events` (
  `userid` INT(11) NOT NULL,
  `eventid` INT(11) NOT NULL,
	`event_name` VARCHAR(300) NOT NULL,
	`event_amount` NUMERIC(15,2) NOT NULL,
	`tickets_quantity` VARCHAR(11) NOT NULL,
	`booked_on` DATETIME NOT NULL,
FOREIGN KEY (userid)
REFERENCES user_signin(userid),
FOREIGN KEY (eventid)
REFERENCES system_events(eventid)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE = InnoDB;

#Library
CREATE TABLE `student_portal`.`system_books` (
	`bookid` INT(11) NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
	`book_name` VARCHAR(300) NOT NULL,
	`book_author` VARCHAR(300) NOT NULL,
	`book_notes` VARCHAR(5000),
	`book_copy_no` INT(11) NOT NULL,
	`book_status` VARCHAR(9) NOT NULL,
	`created_on` DATETIME NOT NULL,
	`updated_on` DATETIME
) ENGINE = InnoDB;

#Library
CREATE TABLE `student_portal`.`reserved_books` (
  `userid` INT(11) NOT NULL,
	`bookid` INT(11) NOT NULL,
	`book_class` VARCHAR(15) NOT NULL,
	`reserved_on` DATE NOT NULL,
	`toreturn_on` DATE NOT NULL,
  `returned_on` DATE NOT NULL,
	`isReturned` TINYINT(1) NOT NULL,
FOREIGN KEY (userid)
REFERENCES user_signin(userid),
FOREIGN KEY (bookid)
REFERENCES system_books(bookid)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE = InnoDB;

#Calendar
CREATE TABLE `student_portal`.`user_tasks` (
	`userid` INT(11) NOT NULL,
	`taskid` INT(11) NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
	`task_name` VARCHAR(70) NOT NULL,
	`task_notes` VARCHAR(5000),
	`task_url` VARCHAR(300),
