-- phpMyAdmin SQL Dump
-- version 2.7.0-pl1
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Jul 03, 2007 at 09:48 PM
-- Server version: 5.0.15
-- PHP Version: 5.0.4
-- 
-- Database: `Friends`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `accept_log`
-- 

CREATE TABLE accept_log (
  accept_id int(11) NOT NULL auto_increment,
  account_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  last_accept datetime default NULL,
  PRIMARY KEY  (accept_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `accounts`
-- 

CREATE TABLE accounts (
  account_id int(11) NOT NULL auto_increment,
  account_name varchar(100) default NULL,
  myspace_password varchar(20) default NULL,
  my_friend_id int(11) NOT NULL,
  PRIMARY KEY  (account_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `comment_log`
-- 

CREATE TABLE comment_log (
  comment_id int(11) NOT NULL auto_increment,
  account_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  result_code char(2) default NULL,
  last_comment datetime NOT NULL COMMENT 'Last time this account left this friend a comment',
  PRIMARY KEY  (comment_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `friend_to_account`
-- 

CREATE TABLE friend_to_account (
  friend_to_account_id int(11) NOT NULL auto_increment,
  friend_id int(11) NOT NULL,
  account_id int(11) NOT NULL,
  friend_since datetime NOT NULL,
  PRIMARY KEY  (friend_to_account_id),
  UNIQUE KEY friend_id (friend_id,account_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `friends`
-- 

CREATE TABLE friends (
  friend_id int(11) NOT NULL,
  first_name varchar(30) default NULL,
  last_name varchar(30) default NULL,
  birthdate date default NULL,
  approve_comments char(1) default NULL,
  is_band char(1) default NULL,
  is_invalid char(1) default NULL,
  is_private char(1) default NULL,
  user_name varchar(50) default NULL,
  url varchar(50) default NULL,
  age int(3) default NULL,
  sex enum('Male','Female') default NULL,
  city varchar(100) default NULL,
  region varchar(100) default NULL,
  country varchar(100) default NULL,
  tagline varchar(255) default NULL,
  profile_views int(11) default NULL,
  member_since date default NULL,
  last_login date default NULL,
  last_update datetime default NULL,
  PRIMARY KEY  (friend_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `message_log`
-- 

CREATE TABLE message_log (
  message_id int(11) NOT NULL auto_increment,
  account_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  result_code char(2) default NULL,
  last_message datetime NOT NULL COMMENT 'Last time this account sent a message to this friend',
  PRIMARY KEY  (message_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `post_log`
-- 

CREATE TABLE post_log (
  post_id int(11) NOT NULL auto_increment,
  post_type char(2) NOT NULL COMMENT '(C)omment, (A)dd Friend request, (M)essage',
  account_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  result_code char(2) default NULL,
  last_post datetime NOT NULL COMMENT 'Last time this account sent this type of post to this friend',
  PRIMARY KEY  (post_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `tracking`
-- 

CREATE TABLE tracking (
  tracking_id int(11) NOT NULL auto_increment,
  account_id int(11) NOT NULL,
  `date` date NOT NULL,
  friend_count int(11) default NULL,
  comment_count int(11) default NULL,
  profile_views int(11) default NULL,
  PRIMARY KEY  (tracking_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `messages`
-- 

CREATE TABLE messages (
  message_id int(11),
  account_id int(11),
  `date` date,
  sender_id int(11),
  status varchar(10),
  subject varchar(255),
  message text,
  PRIMARY KEY (message_id)
);

-- --------------------------------------------------------

-- 
-- Table structure for table `comments`
-- 

CREATE TABLE comments (
  comment_id int(11) NOT NULL auto_increment,
  friend_id int(11),
  `time` datetime,
  sender_id int(11),
  comment text,
  PRIMARY KEY (comment_id)
);