Saturday, 25 May 2013

Created Database

I have created a database, that matched the application current needs. So far there is three tables:
  • Place table: Which represents each Discovered Place.
  • Photo Table: Which is  table that contains an images location and the Place it belongs to.
  • Posts  table: Contains a table filled with posts relating to places and other meta data such as a Time stamp.
I having been testing this Database out in my WAMP server at home. Next Step will be adding this to Amazon Web Server.

CREATE TABLE IF NOT EXISTS `place` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` text NOT NULL,
  `Latitude` double NOT NULL,
  `Longitude` double NOT NULL,
  `DateFound` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

CREATE TABLE IF NOT EXISTS `photos` (
  `PhotoID` int(11) NOT NULL AUTO_INCREMENT,
  `PlaceID` int(11) NOT NULL,
  `ImageURL` text NOT NULL,
  PRIMARY KEY (`PhotoID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `posts` (
  `PostID` int(11) NOT NULL AUTO_INCREMENT,
  `PlaceID` int(11) NOT NULL,
  `Post` text NOT NULL,
  `DatePosted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `UserID` int(11) NOT NULL,
  `Rating` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`PostID`)


) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

No comments:

Post a Comment