CREATE TABLE BBoardAccess (
  BBoardAccessID int(11) NOT NULL auto_increment,
  BBoardsID int(11) NOT NULL default '0',
  BUsersID int(11) NOT NULL default '0',
  Access text NOT NULL,
  PRIMARY KEY (BBoardAccessID),
  KEY BBoardsID(BBoardsID),
  KEY BUsersID(BUsersID)
) TYPE=MyISAM;

CREATE TABLE BBoardBold (
  BBoardBoldID int(11) NOT NULL auto_increment,
  BBoardsID int(11) NOT NULL default '0',
  BUsersID int(11) NOT NULL default '0',
  PRIMARY KEY (BBoardBoldID),
  KEY BBoardsID(BBoardsID),
  KEY BUsersID(BUsersID)
) TYPE=MyISAM;

CREATE TABLE BBoardHits (
  BBoardHitsID int(11) NOT NULL auto_increment,
  BBoardsID int(11) NOT NULL default '0',
  BUsersID int(11) NOT NULL default '0',
  Hits int(11) NOT NULL default '0',
  PRIMARY KEY (BBoardHitsID),
  KEY BBoardsID(BBoardsID),
  KEY BUsersID(BUsersID)
) TYPE=MyISAM;

CREATE TABLE BBoards (
  BBoardsID int(11) NOT NULL auto_increment,
  Name text NOT NULL,
  BBranchesID int(11) NOT NULL default '0',
  Long_Name text NOT NULL,
  PostCount int(11) NOT NULL default '0',
  Homepage text NOT NULL,
  PRIMARY KEY (BBoardsID),
  KEY BBranchesID(BBranchesID)
) TYPE=MyISAM;

CREATE TABLE BBranches (
  BBranchesID int(11) NOT NULL auto_increment,
  Name text NOT NULL,
  PRIMARY KEY (BBranchesID)
) TYPE=MyISAM;

CREATE TABLE BFavBoards (
  BFavBoardsID int(11) NOT NULL auto_increment,
  BUsersID int(11) NOT NULL default '0',
  BBoardsID int(11) NOT NULL default '0',
  PRIMARY KEY (BFavBoardsID),
  KEY BUsersID(BUsersID),
  KEY BBoardsID(BBoardsID)
) TYPE=MyISAM;

CREATE TABLE BHistory (
  BHistoryID int(11) NOT NULL auto_increment,
  BUsersID int(11) NOT NULL default '0',
  BPostsID int(11) NOT NULL default '0',
  PRIMARY KEY (BHistoryID),
  KEY BUsersID(BUsersID),
  KEY BPostsID(BPostsID)
) TYPE=MyISAM;

CREATE TABLE BPosts (
  BPostsID int(11) NOT NULL auto_increment,
  BBoardsID int(11) NOT NULL default '0',
  Subject text NOT NULL,
  Writer text NOT NULL,
  BUsersID int(11) NOT NULL default '0',
  Time int(11) NOT NULL default '0',
  Message text NOT NULL,
  PostCount int(11) NOT NULL default '0',
  Remote_Name text NOT NULL,
  PRIMARY KEY (BPostsID),
  KEY BUsersID(BUsersID),
  KEY BBoardsID(BBoardsID),
  FULLTEXT KEY Message(Message,Subject)
) TYPE=MyISAM;

CREATE TABLE BReplies (
  BRepliesID int(11) NOT NULL auto_increment,
  Writer text NOT NULL,
  BUsersID int(11) NOT NULL default '0',
  Time int(11) NOT NULL default '0',
  Message text NOT NULL,
  InReplyTo int(11) NOT NULL default '0',
  BPostsID int(11) NOT NULL default '0',
  PostCount int(11) NOT NULL default '0',
  Remote_Name text NOT NULL,
  PRIMARY KEY (BRepliesID),
  KEY BPostsID(BPostsID),
  KEY BUsersID(BUsersID),
  FULLTEXT KEY Message(Message)
) TYPE=MyISAM;

CREATE TABLE BUsers (
  BUsersID int(11) NOT NULL auto_increment,
  Username text NOT NULL,
  Password text NOT NULL,
  First_Name text NOT NULL,
  Last_Name text NOT NULL,
  Email text NOT NULL,
  Last_Logon int(11) NOT NULL default '0',
  Header text NOT NULL,
  Sidebar text NOT NULL,
  AllBoards text NOT NULL,
  Location text NOT NULL,
  Administrator char(1) NOT NULL default 'N',
  AdminRealmID int(11) NOT NULL default '0',
  Enabled char(1) NOT NULL default 'Y',
  PRIMARY KEY (BUsersID),
  KEY Username(Username(10))
) TYPE=MyISAM;

INSERT INTO busers VALUES (1, 'Guest', PASSWORD('guest'), '', '', '', 0, '', '', '', '', 'N', 0, 'Y');

INSERT INTO busers VALUES (2, 'Admin', PASSWORD('admin'), '', '', '', 0, '', '', '', '', 'S', 0, 'Y');