#
# Table structure for table `forum`
#

CREATE TABLE forum (
  id int(10) unsigned NOT NULL auto_increment,
  course int(10) unsigned NOT NULL default '0',
  type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general',
  name varchar(255) NOT NULL default '',
  intro text NOT NULL,
  open tinyint(1) unsigned NOT NULL default '0',
  assessed tinyint(1) unsigned NOT NULL default '0',
  forcesubscribe tinyint(1) unsigned NOT NULL default '0',
  timemodified int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (id),
  UNIQUE KEY id (id)
) COMMENT='Forums contain and structure discussion';
# --------------------------------------------------------

#
# Table structure for table `forum_discussions`
#

CREATE TABLE forum_discussions (
  id int(10) unsigned NOT NULL auto_increment,
  course int(10) unsigned NOT NULL default '0',
  forum int(10) unsigned NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  firstpost int(10) unsigned NOT NULL default '0',
  assessed tinyint(1) NOT NULL default '1',
  timemodified int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (id)
) COMMENT='Forums are composed of discussions';
# --------------------------------------------------------

#
# Table structure for table `forum_posts`
#

CREATE TABLE forum_posts (
  id int(10) unsigned NOT NULL auto_increment,
  discussion int(10) unsigned NOT NULL default '0',
  parent int(10) unsigned NOT NULL default '0',
  user int(10) unsigned NOT NULL default '0',
  created int(10) unsigned NOT NULL default '0',
  modified int(10) unsigned NOT NULL default '0',
  mailed tinyint(1) unsigned NOT NULL default '0',
  subject varchar(255) NOT NULL default '',
  message text NOT NULL,
  totalscore tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (id)
) COMMENT='All posts are stored in this table';
# --------------------------------------------------------

#
# Table structure for table `forum_ratings`
#

CREATE TABLE forum_ratings (
  id int(10) unsigned NOT NULL auto_increment,
  user int(10) unsigned NOT NULL default '0',
  post int(10) unsigned NOT NULL default '0',
  time int(10) unsigned NOT NULL default '0',
  rating tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (id)
) COMMENT='Contains user ratings for individual posts';
# --------------------------------------------------------

#
# Table structure for table `forum_subscriptions`
#

CREATE TABLE forum_subscriptions (
  id int(10) unsigned NOT NULL auto_increment,
  user int(10) unsigned NOT NULL default '0',
  forum int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (id),
  UNIQUE KEY id (id)
) COMMENT='Keeps track of who is subscribed to what forum';
# --------------------------------------------------------

#
# Dumping data for table `log_display`
#

INSERT INTO log_display VALUES ('forum', 'add', 'forum', 'name');
INSERT INTO log_display VALUES ('forum', 'update', 'forum', 'name');
INSERT INTO log_display VALUES ('forum', 'add discussion', 'forum_discussions', 'name');
INSERT INTO log_display VALUES ('forum', 'add post', 'forum_posts', 'subject');
INSERT INTO log_display VALUES ('forum', 'update post', 'forum_posts', 'subject');
INSERT INTO log_display VALUES ('forum', 'view subscribers', 'forum', 'name');
INSERT INTO log_display VALUES ('forum', 'view discussion', 'forum_discussions', 'name');
INSERT INTO log_display VALUES ('forum', 'view forum', 'forum', 'name');
INSERT INTO log_display VALUES ('forum', 'subscribe', 'forum', 'name');
INSERT INTO log_display VALUES ('forum', 'unsubscribe', 'forum', 'name');

