# This file is part of aroundme
#  
# Copyright (C) 2003, 2005 Barnraiser
# http://www.barnraiser.org/
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with program; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# 

# Table structure for table `am_abuse`
CREATE TABLE `am_abuse` (
  `abuse_id` int(11) NOT NULL auto_increment,
  `abuse_url` varchar(255) default NULL,
  `abuse_source` text,
  `reportee_user_id` int(11) default NULL,
  `assigned_user_id` int(11) default NULL,
  `abuse_note` text,
  `reportee_language_id` int(3) default NULL,
  `report_datetime` datetime default NULL,
  `report_status_id` int(11) default NULL,
  PRIMARY KEY  (`abuse_id`)
) TYPE=MyISAM COMMENT='record of all instances of reported abuse';


# Table structure for table `am_acs_group_role`
CREATE TABLE `am_acs_group_role` (
  `role_id` int(11) NOT NULL auto_increment,
  `role_name` varchar(255) default NULL,
  `group_id` int(11) default NULL,
  `role_default` int(1) default NULL,
  PRIMARY KEY  (`role_id`)
) TYPE=MyISAM COMMENT='access control system';


# Table structure for table `am_acs_permission`
CREATE TABLE `am_acs_permission` (
  `section_id` int(3) default NULL,
  `role_id` int(3) default NULL,
  `privilege_id` int(3) default NULL,
  `resource_id` int(3) default NULL
) TYPE=MyISAM COMMENT='access control system';


# Table structure for table `am_activity`
CREATE TABLE `am_activity` (
  `activity_id` int(11) NOT NULL auto_increment,
  `section_id` int(11) default NULL,
  `section_item_id` int(11) default NULL,
  `activity_create_datetime` datetime default NULL,
  `activity_start_datetime` datetime default NULL,
  `activity_start_day` int(11) default NULL,
  `activity_start_month` int(11) default NULL,
  `activity_start_year` int(11) default NULL,
  `activity_start_hour` int(11) default NULL,
  `activity_start_minute` int(11) default NULL,
  `activity_start_weekday` int(11) default NULL,
  `activity_end_datetime` datetime default NULL,
  `activity_end_day` int(11) default NULL,
  `activity_end_month` int(11) default NULL,
  `activity_end_year` int(11) default NULL,
  `activity_end_hour` int(11) default NULL,
  `activity_end_minute` int(11) default NULL,
  `activity_end_weekday` int(11) default NULL,
  `activity_title` varchar(255) default NULL,
  `activity_synopsis` text,
  `activity_body` text,
  `activity_location` varchar(255) default NULL,
  `activity_frequency` int(11) default NULL,
  `file_id` int(11) default NULL,
  `user_id` int(11) default NULL,
  `activity_type_id` int(11) default NULL,
  `status_id` int(11) default NULL,
  PRIMARY KEY  (`activity_id`)
) TYPE=MyISAM;


# Table structure for table `am_activity_user`
CREATE TABLE `am_activity_user` (
  `activity_user_id` int(11) NOT NULL auto_increment,
  `activity_id` int(11) default NULL,
  `user_id` int(11) default NULL,
  `activity_user_create_datetime` datetime default NULL,
  `activity_user_edit_datetime` datetime default NULL,
  `activity_user_status` int(11) default NULL,
  `user_id_edit` int(11) default NULL,
  PRIMARY KEY  (`activity_user_id`)
) TYPE=MyISAM;


# Table structure for table `am_activity_task`
CREATE TABLE `am_activity_task` (
  `task_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `activity_id` int(11) default NULL,
  `task_type_id` int(3) default NULL,
  `task_title` varchar(255) default NULL,
  `task_synopsis` text,
  `task_start_datetime` datetime default NULL,
  `task_end_datetime` datetime default NULL,
  `task_create_datetime` datetime default NULL,
  `task_user_requirement` int(11) default NULL,
  PRIMARY KEY  (`task_id`)
) TYPE=MyISAM;


# Table structure for table `am_activity_task_user`
CREATE TABLE `am_activity_task_user` (
  `task_user_id` int(11) NOT NULL auto_increment,
  `task_id` int(11) default NULL,
  `user_id` int(11) default NULL,
  `task_user_create_datetime` datetime default NULL,
  `status_id` int(2) default NULL,
  PRIMARY KEY  (`task_user_id`)
) TYPE=MyISAM;


# Table structure for table `am_blog`
CREATE TABLE `am_blog` (
  `blog_id` int(11) NOT NULL auto_increment,
  `section_id` int(1) default NULL,
  `section_item_id` int(3) default NULL,
  `blog_title` varchar(255) default NULL,
  `blog_synopsis` varchar(255) default NULL,
  `blog_body` text,
  `language_id` int(3) default NULL,
  `degree_id` int(3) default NULL,
  `level_id` int(3) default NULL,
  `blog_create_datetime` datetime default NULL,
  `genre_id` int(3) default NULL,
  `blog_allow_comments` int(1) default NULL,
  `file_id` int(11) default NULL,
  `user_id` int(11) default NULL,
  PRIMARY KEY  (`blog_id`)
) TYPE=MyISAM;


# Table structure for table `am_bookmark`
CREATE TABLE `am_bookmark` (
  `item_id` int(11) default NULL,
  `cms_item_type_id` int(3) default NULL,
  `bookmark_type` int(1) default NULL,
  `user_id` int(11) default NULL,
  `bookmark_lastview_datetime` datetime default NULL
) TYPE=MyISAM;


# Table structure for table `am_cms`
CREATE TABLE `am_cms` (
  `section_id` int(1) default NULL,
  `section_item_id` int(3) default NULL,
  `item_id` int(11) default NULL,
  `cms_item_type_id` int(2) default NULL,
  `cms_publish_datetime` datetime default NULL,
  `status_id` int(1) default NULL,
  `level_id` int(1) default NULL,
  `language_id` int(3) default NULL,
  `genre_id` int(3) default NULL,
  `cms_sticky` int(1) default NULL
) TYPE=MyISAM COMMENT='content management system';


# Table structure for table `am_comment`
CREATE TABLE `am_comment` (
  `comment_id` int(11) NOT NULL auto_increment,
  `comment_parent_id` int(11) default NULL,
  `item_id` int(11) default NULL,
  `cms_item_type_id` int(3) default NULL,
  `comment_body` text,
  `comment_create_datetime` datetime default NULL,
  `user_id` int(11) default NULL,
  PRIMARY KEY  (`comment_id`)
) TYPE=MyISAM;


# Table structure for table `am_file`
CREATE TABLE `am_file` (
  `file_id` int(11) NOT NULL auto_increment,
  `section_id` int(1) default NULL,
  `section_item_id` int(11) default NULL,
  `file_name` varchar(50) default NULL,
  `file_suffix` varchar(4) default NULL,
  `file_create_datetime` datetime default NULL,
  `file_title` varchar(255) default NULL,
  `file_size` int(11) default NULL,
  `user_id` int(11) default NULL,
  PRIMARY KEY  (`file_id`)
) TYPE=MyISAM PACK_KEYS=0;


# Table structure for table `am_forum_subject`
CREATE TABLE `am_forum_subject` (
  `subject_id` int(11) NOT NULL auto_increment,
  `topic_id` int(11) default NULL,
  `subject_title` varchar(255) default NULL,
  `file_id` int(11) default NULL,
  `user_id` int(11) default NULL,
  `subject_hidden` int(1) default NULL,
  `subject_body` text,
  `subject_create_datetime` datetime default NULL,
  `subject_locked` int(1) default NULL,
  `subject_sticky` int(1) default NULL,
  PRIMARY KEY  (`subject_id`)
) TYPE=MyISAM;


# Table structure for table `am_forum_topic`
CREATE TABLE `am_forum_topic` (
  `topic_id` int(11) NOT NULL auto_increment,
  `section_id` int(1) default NULL,
  `section_item_id` int(11) default NULL,
  `topic_title` varchar(50) default NULL,
  `topic_synopsis` varchar(255) default NULL,
  `topic_hidden` int(1) default NULL,
  `topic_create_datetime` datetime default NULL,
  `user_id` int(11) default NULL,
  PRIMARY KEY  (`topic_id`)
) TYPE=MyISAM;


# Table structure for table `am_group`
CREATE TABLE `am_group` (
  `group_id` int(11) NOT NULL auto_increment,
  `group_title` varchar(255) default NULL,
  `group_synopsis` varchar(255) default NULL,
  `group_home_synopsis` text,
  `group_rules` text,
  `group_election_date` date default NULL,
  `language_id` int(3) default NULL,
  `group_create_datetime` datetime default NULL,
  `group_registration_type` int(11) default NULL,
  `group_from_age` int(11) default NULL,
  `group_to_age` int(11) default NULL,
  `genre_id` int(3) default NULL,
  `group_cms_auto_publish` int(1) default NULL,
  `user_id` int(11) default NULL,
  `file_id` int(11) default NULL,
  `group_visibility` int(1) default NULL,
  `group_file_allocation` int(11) default NULL,
  `status_id` int(3) default NULL,
  PRIMARY KEY  (`group_id`)
) TYPE=MyISAM PACK_KEYS=0;


# Table structure for table `am_group_membership`
CREATE TABLE `am_group_membership` (
  `membership_id` int(11) NOT NULL auto_increment,
  `membership_number` varchar(100) default NULL,
  `group_id` int(11) default NULL,
  `status_id` int(3) default NULL,
  `role_id` int(11) default NULL,
  `membership_create_datetime` datetime default NULL,
  `user_id` int(11) default NULL,
  `profile_id` int(11) default NULL,
  `node_id` int(11) default NULL,
  PRIMARY KEY  (`membership_id`)
) TYPE=MyISAM;


# Table structure for table `am_library`
CREATE TABLE `am_library` (
  `library_id` int(11) NOT NULL auto_increment,
  `library_page_name` varchar(100) default NULL,
  `section_id` int(1) default NULL,
  `section_item_id` int(11) default NULL,
  `library_default` int(1) default NULL,
  `library_title` varchar(255) default NULL,
  `library_synopsis` text,
  `library_body` text,
  `file_id` int(11) default NULL,
  `level_id` int(3) default NULL,
  `degree_id` int(3) default NULL,
  `user_id` int(11) default NULL,
  `library_allow_comments` int(1) default NULL,
  `library_create_datetime` datetime default NULL,
  PRIMARY KEY  (`library_id`)
) TYPE=MyISAM;


# Table structure for table `am_poll`
CREATE TABLE `am_poll` (
  `poll_id` int(11) NOT NULL auto_increment,
  `section_id` int(1) default NULL,
  `section_item_id` int(11) default NULL,
  `poll_question` varchar(255) default NULL,
  `poll_start_datetime` datetime default NULL,
  `poll_end_datetime` datetime default NULL,
  `poll_anon` int(1) default NULL,
  `user_id` int(11) default NULL,
  `poll_create_datetime` datetime default NULL,
  `vote_required` int(1) default NULL,
  PRIMARY KEY  (`poll_id`)
) TYPE=MyISAM;


# Table structure for table `am_poll_answer`
CREATE TABLE `am_poll_answer` (
  `answer_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `poll_id` int(11) default NULL,
  `option_id` int(11) default NULL,
  `current_answer` int(1) default NULL,
  `answer_create_datetime` datetime default NULL,
  PRIMARY KEY  (`answer_id`)
) TYPE=MyISAM;


# Table structure for table `am_poll_option`
CREATE TABLE `am_poll_option` (
  `option_id` int(11) NOT NULL auto_increment,
  `poll_id` int(11) default NULL,
  `option_body` varchar(255) default NULL,
  `option_create_datetime` datetime default NULL,
  `user_id` int(11) default NULL,
  PRIMARY KEY  (`option_id`)
) TYPE=MyISAM;


# Table structure for table `am_shoutbox`
CREATE TABLE `am_shoutbox` (
  `shoutbox_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `shoutbox_body` varchar(200) default NULL,
  `shoutbox_create_datetime` datetime default NULL,
  PRIMARY KEY  (`shoutbox_id`)
) TYPE=MyISAM;


# Table structure for table `am_sn`
CREATE TABLE `am_sn` (
  `user_id` int(11) default NULL,
  `profile_id` int(11) default NULL,
  `degree_id` int(3) default NULL,
  `sn_total` int(11) default NULL,
  `sn_update_datetime` datetime default NULL
) TYPE=MyISAM;


# Table structure for table `am_statistic`
CREATE TABLE `am_statistic` (
  `section_id` int(1) default NULL,
  `section_item_id` int(11) default NULL,
  `statistic_type_id` int(3) default NULL,
  `total` int(11) default NULL,
  `user_id` int(11) default NULL
) TYPE=MyISAM;


# Table structure for table `am_template`
CREATE TABLE `am_template` (
  `template_id` int(11) NOT NULL auto_increment,
  `template_title` varchar(50) default NULL,
  PRIMARY KEY  (`template_id`)
) TYPE=MyISAM;


# Table structure for table `am_user`
CREATE TABLE `am_user` (
  `user_id` int(11) NOT NULL auto_increment,
  `user_number` varchar(50) default NULL,
  `user_firstname` varchar(100) default NULL,
  `user_surname` varchar(100) default NULL,
  `user_email` varchar(100) NOT NULL default '',
  `user_hometown` varchar(100) default NULL,
  `user_dob` date default NULL,
  `user_gender` int(1) default NULL,
  `language_id` int(3) default NULL,
  `template_id` int(3) default NULL,
  `user_homepage` varchar(50) default NULL,
  `status_id` int(3) default NULL,
  `role_id` int(11) default NULL,
  `user_password` varchar(32) NOT NULL default '',  
  `user_feed_password` varchar(6) default NULL,
  `user_create_datetime` datetime default NULL,
  `active_time` timestamp(14) NOT NULL,
  `user_file_allocation` int(11) default NULL,
  `node_id` int(11) default NULL,
  PRIMARY KEY  (`user_id`)
) TYPE=MyISAM PACK_KEYS=0;


# Table structure for table `am_user_blocked`
CREATE TABLE `am_user_blocked` (
  `user_id_blocker` int(11) default NULL,
  `user_id_blocked` int(11) default NULL,
  `profile_id_blocked` int(11) default NULL,
  `block_datetime` datetime default NULL,
  `block_description` varchar(200) default NULL
) TYPE=MyISAM;


# Table structure for table `am_user_invited`
CREATE TABLE `am_user_invited` (
  `invited_email` varchar(100) default NULL,
  `user_id` int(11) default NULL,
  `invite_create_datetime` datetime default NULL
) TYPE=MyISAM COMMENT='logs pending invites';


# Table structure for table `am_user_language`
CREATE TABLE `am_user_language` (
  `user_id` int(11) default NULL,
  `language_id` int(3) default NULL
) TYPE=MyISAM;


# Table structure for table `am_user_message`
CREATE TABLE `am_user_message` (
  `message_id` int(11) NOT NULL auto_increment,
  `owner_user_id` int(11) default NULL,
  `from_user_id` int(11) default NULL,
  `to_user_id` int(11) default NULL,
  `message_status` int(3) default NULL,
  `message_box` int(3) default NULL,
  `message_subject` varchar(50) default NULL,
  `message_body` text,
  `message_create_datetime` datetime default NULL,
  `message_type` int(3) default NULL,
  PRIMARY KEY  (`message_id`)
) TYPE=MyISAM PACK_KEYS=0;


# Table structure for table `am_user_profile`
CREATE TABLE `am_user_profile` (
  `profile_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `profile_default` int(1) default NULL,
  `profile_name` varchar(50) default NULL,
  `profile_summary` text,
  `profile_gender` int(1) default NULL,
  `profile_nic` varchar(50) default NULL,
  `profile_hometown` varchar(50) default NULL,
  `profile_create_datetime` datetime default NULL,
  `profile_allow_comments` int(1) default NULL,
  `profile_allow_msg` int(1) default NULL,
  `file_id` int(11) default NULL,
  `profile_text1` varchar(100) default NULL,
  `profile_text2` varchar(100) default NULL,
  `profile_text3` varchar(100) default NULL,
  `profile_text4` varchar(100) default NULL,
  `profile_text5` varchar(100) default NULL,
  `profile_text6` varchar(100) default NULL,
  `profile_text7` varchar(100) default NULL,
  `profile_text8` varchar(100) default NULL,
  `profile_text9` varchar(100) default NULL,
  `profile_text10` varchar(100) default NULL,
  PRIMARY KEY  (`profile_id`)
) TYPE=MyISAM PACK_KEYS=0;


# Table structure for table `am_user_relation`
CREATE TABLE `am_user_relation` (
  `user_id` int(11) default NULL,
  `user_id_friend` int(11) default NULL,
  `node_id` int(11) default NULL,
  `relation_create_datetime` datetime default NULL,
  `relation_type_id` int(3) default NULL
) TYPE=MyISAM;


# Table structure for table `am_user_session`
CREATE TABLE `am_user_session` (
  `session_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `session_md5` varchar(32) default NULL,
  `session_lastused` timestamp(14) NOT NULL,
  `session_firstused` timestamp(14) NOT NULL,
  `session_ip` varchar(15) default NULL,
  PRIMARY KEY  (`session_id`)
) TYPE=MyISAM;


# INSERT DEFAULTS -----------------------------------------

INSERT INTO `am_template` VALUES (1, 'am_default');