# Foorum::Schema version 0.1.8

- BannedIp
- Comment
- FilterWord
- Forum
- ForumSettings
- Hit
- LogAction
- LogError
- LogPath
- Message
- MessageUnread
- Poll
- PollOption
- PollResult
- ScheduledEmail
- Session
- Share
- Star
- Stat
- Topic
- Upload
- User
- UserActivation
- UserDetails
- UserForum
- UserOnline
- UserProfilePhoto
- UserRole
- UserSettings
- Variables
- Visit

## BannedIp (table banned_ip)

### Columns

Name | Type | Info
--- | --- | ---
ip_id | INT(11) | NOT NULL, PRIMARY KEY
cidr_ip | VARCHAR(20) | NOT NULL
time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | ip_id

## Comment (table comment)

### Columns

Name | Type | Info
--- | --- | ---
comment_id | INT(11) | NOT NULL, PRIMARY KEY
reply_to | INT(11) | NOT NULL
text | TEXT(65535) | NOT NULL
post_on | INT(11) | NOT NULL
update_on | INT(11) |
post_ip | VARCHAR(32) | NOT NULL
formatter | VARCHAR(16) | NOT NULL, DEFAULT VALUE 'ubb'
object_type | VARCHAR(30) | NOT NULL
object_id | INT(11) | NOT NULL
author_id | INT(11) | NOT NULL
title | VARCHAR(255) | NOT NULL
forum_id | INT(11) | NOT NULL
upload_id | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | comment_id

### Relationships

might_have
Name | Foreign Class | Join Condition
--- | --- | ---
upload |  | foreign.upload_id => self.upload_id

## FilterWord (table filter_word)

### Columns

Name | Type | Info
--- | --- | ---
word | VARCHAR(64) | NOT NULL, PRIMARY KEY
type | ENUM(19) | NOT NULL, PRIMARY KEY, DEFAULT VALUE 'username_reserved'

### Unique Constraints

Name | Columns
--- | ---
primary | word, type

## Forum (table forum)

### Columns

Name | Type | Info
--- | --- | ---
forum_id | INT(11) | NOT NULL, PRIMARY KEY
forum_code | VARCHAR(25) | NOT NULL
name | VARCHAR(100) | NOT NULL
description | VARCHAR(255) | NOT NULL
forum_type | VARCHAR(16) | NOT NULL
policy | ENUM(9) | NOT NULL, DEFAULT VALUE 'public'
total_members | INT(8) | NOT NULL
total_topics | INT(11) | NOT NULL
total_replies | INT(11) | NOT NULL
status | ENUM(7) | NOT NULL, DEFAULT VALUE 'healthy'
last_post_id | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | forum_id
forum_code | forum_code

### Relationships

has_many
Name | Foreign Class | Join Condition
--- | --- | ---
topics |  | foreign.forum_id => self.forum_id

## ForumSettings (table forum_settings)

### Columns

Name | Type | Info
--- | --- | ---
forum_id | INT(11) | NOT NULL, PRIMARY KEY
type | VARCHAR(48) | NOT NULL, PRIMARY KEY
value | VARCHAR(48) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | forum_id, type

## Hit (table hit)

### Columns

Name | Type | Info
--- | --- | ---
hit_id | INT(11) | NOT NULL, PRIMARY KEY
object_type | VARCHAR(12) | NOT NULL
object_id | INT(11) | NOT NULL
hit_new | INT(11) | NOT NULL
hit_today | INT(11) | NOT NULL
hit_yesterday | INT(11) | NOT NULL
hit_weekly | INT(11) | NOT NULL
hit_monthly | INT(11) | NOT NULL
hit_all | INT(11) | NOT NULL
last_update_time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | hit_id

## LogAction (table log_action)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL
action | VARCHAR(24) |
object_type | VARCHAR(12) |
object_id | INT(11) |
time | INT(11) | NOT NULL
text | TEXT(65535) |
forum_id | INT(11) | NOT NULL

## LogError (table log_error)

### Columns

Name | Type | Info
--- | --- | ---
error_id | INT(11) | NOT NULL, PRIMARY KEY
level | ENUM(5) | NOT NULL, DEFAULT VALUE 'debug'
text | TEXT(65535) | NOT NULL
time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | error_id

## LogPath (table log_path)

### Columns

Name | Type | Info
--- | --- | ---
path_id | INT(11) | NOT NULL, PRIMARY KEY
session_id | VARCHAR(72) |
user_id | INT(11) | NOT NULL
path | VARCHAR(255) | NOT NULL
get | VARCHAR(255) |
post | TEXT(65535) |
time | INT(11) | NOT NULL
loadtime | DOUBLE(64) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | path_id

## Message (table message)

### Columns

Name | Type | Info
--- | --- | ---
message_id | INT(11) | NOT NULL, PRIMARY KEY
from_id | INT(11) | NOT NULL
to_id | INT(11) | NOT NULL
title | VARCHAR(255) | NOT NULL
text | TEXT(65535) | NOT NULL
post_on | INT(11) | NOT NULL
post_ip | VARCHAR(32) | NOT NULL
from_status | ENUM(7) | NOT NULL, DEFAULT VALUE 'open'
to_status | ENUM(7) | NOT NULL, DEFAULT VALUE 'open'

### Unique Constraints

Name | Columns
--- | ---
primary | message_id

### Relationships

has_one
Name | Foreign Class | Join Condition
--- | --- | ---
recipient |  | foreign.user_id => self.to_id
sender |  | foreign.user_id => self.from_id

## MessageUnread (table message_unread)

### Columns

Name | Type | Info
--- | --- | ---
message_id | INT(11) | NOT NULL, PRIMARY KEY
user_id | INT(11) | NOT NULL, PRIMARY KEY

### Unique Constraints

Name | Columns
--- | ---
primary | message_id, user_id

## Poll (table poll)

### Columns

Name | Type | Info
--- | --- | ---
poll_id | INT(11) | NOT NULL, PRIMARY KEY
forum_id | INT(11) | NOT NULL
author_id | INT(11) | NOT NULL
multi | ENUM(1) | NOT NULL
anonymous | ENUM(1) | NOT NULL
time | INT(10) |
duration | INT(10) |
vote_no | MEDIUMINT(8) | NOT NULL
title | VARCHAR(128) |
hit | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | poll_id

### Relationships

might_have
Name | Foreign Class | Join Condition
--- | --- | ---
author |  | foreign.user_id => self.author_id

has_many
Name | Foreign Class | Join Condition
--- | --- | ---
options |  | foreign.poll_id => self.poll_id
results |  | foreign.poll_id => self.poll_id

## PollOption (table poll_option)

### Columns

Name | Type | Info
--- | --- | ---
option_id | INT(11) | NOT NULL, PRIMARY KEY
poll_id | INT(11) | NOT NULL
text | VARCHAR(255) |
vote_no | MEDIUMINT(8) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | option_id

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
poll |  | foreign.poll_id => self.poll_id

has_many
Name | Foreign Class | Join Condition
--- | --- | ---
results |  | foreign.option_id => self.option_id

## PollResult (table poll_result)

### Columns

Name | Type | Info
--- | --- | ---
option_id | INT(11) | NOT NULL
poll_id | INT(11) | NOT NULL
poster_id | INT(11) | NOT NULL
poster_ip | VARCHAR(32) |

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
option |  | foreign.option_id => self.option_id
poll |  | foreign.poll_id => self.poll_id

## ScheduledEmail (table scheduled_email)

### Columns

Name | Type | Info
--- | --- | ---
email_id | INT(11) | NOT NULL, PRIMARY KEY
email_type | VARCHAR(24) |
processed | ENUM(1) | NOT NULL, DEFAULT VALUE 'N'
from_email | VARCHAR(128) |
to_email | VARCHAR(128) |
subject | TEXT(65535) |
plain_body | TEXT(65535) |
html_body | TEXT(65535) |
time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | email_id

## Session (table session)

### Columns

Name | Type | Info
--- | --- | ---
id | CHAR(72) | NOT NULL, PRIMARY KEY
session_data | TEXT(65535) |
expires | INT(11) |

### Unique Constraints

Name | Columns
--- | ---
primary | id

## Share (table share)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
object_type | VARCHAR(12) | NOT NULL, PRIMARY KEY
object_id | INT(11) | NOT NULL, PRIMARY KEY
time | INT(10) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id, object_id, object_type

## Star (table star)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
object_type | VARCHAR(12) | NOT NULL, PRIMARY KEY
object_id | INT(11) | NOT NULL, PRIMARY KEY
time | INT(10) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id, object_id, object_type

## Stat (table stat)

### Columns

Name | Type | Info
--- | --- | ---
stat_id | INT(11) | NOT NULL, PRIMARY KEY
stat_key | VARCHAR(255) | NOT NULL
stat_value | BIGINT(21) | NOT NULL
date | DATE(10) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | stat_id

## Topic (table topic)

### Columns

Name | Type | Info
--- | --- | ---
topic_id | INT(11) | NOT NULL, PRIMARY KEY
forum_id | INT(11) | NOT NULL
post_on | INT(11) | NOT NULL
title | VARCHAR(255) |
closed | ENUM(1) | NOT NULL
sticky | ENUM(1) | NOT NULL
elite | ENUM(1) | NOT NULL
hit | INT(11) | NOT NULL
last_updator_id | INT(11) | NOT NULL
last_update_date | INT(11) |
author_id | INT(11) | NOT NULL
total_replies | INT(11) | NOT NULL
status | ENUM(7) | NOT NULL, DEFAULT VALUE 'healthy'

### Unique Constraints

Name | Columns
--- | ---
primary | topic_id

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
forum |  | foreign.forum_id => self.forum_id

might_have
Name | Foreign Class | Join Condition
--- | --- | ---
author |  | foreign.user_id => self.author_id
last_updator |  | foreign.user_id => self.last_updator_id

## Upload (table upload)

### Columns

Name | Type | Info
--- | --- | ---
upload_id | INT(11) | NOT NULL, PRIMARY KEY
user_id | INT(11) | NOT NULL
forum_id | INT(11) | NOT NULL
filename | VARCHAR(36) |
filesize | DOUBLE(64) |
filetype | VARCHAR(4) |

### Unique Constraints

Name | Columns
--- | ---
primary | upload_id

## User (table user)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
username | VARCHAR(32) | NOT NULL
password | VARCHAR(32) | NOT NULL, DEFAULT VALUE '000000'
nickname | VARCHAR(100) | NOT NULL
gender | ENUM(2) | NOT NULL, DEFAULT VALUE 'NA'
email | VARCHAR(255) | NOT NULL
register_time | INT(11) | NOT NULL
register_ip | VARCHAR(32) | NOT NULL
last_login_on | INT(11) |
last_login_ip | VARCHAR(32) |
login_times | MEDIUMINT(8) | NOT NULL, DEFAULT VALUE '1'
status | ENUM(10) | NOT NULL, DEFAULT VALUE 'unverified'
threads | INT(11) | NOT NULL
replies | INT(11) | NOT NULL
lang | CHAR(2) | DEFAULT VALUE 'cn'
country | CHAR(2) | DEFAULT VALUE 'cn'
state_id | INT(11) | NOT NULL
city_id | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
email | email
primary | user_id
username | username

### Relationships

might_have
Name | Foreign Class | Join Condition
--- | --- | ---
details |  | foreign.user_id => self.user_id

## UserActivation (table user_activation)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
activation_code | VARCHAR(12) |
new_email | VARCHAR(255) |

### Unique Constraints

Name | Columns
--- | ---
primary | user_id

## UserDetails (table user_details)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
qq | VARCHAR(14) |
msn | VARCHAR(64) |
yahoo | VARCHAR(64) |
skype | VARCHAR(64) |
gtalk | VARCHAR(64) |
homepage | VARCHAR(255) |
birthday | DATE(10) |

### Unique Constraints

Name | Columns
--- | ---
primary | user_id

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
user |  | foreign.user_id => self.user_id

## UserForum (table user_forum)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
forum_id | INT(11) | NOT NULL, PRIMARY KEY
status | ENUM(9) | NOT NULL, DEFAULT VALUE 'user'
time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id, forum_id

## UserOnline (table user_online)

### Columns

Name | Type | Info
--- | --- | ---
sessionid | VARCHAR(72) | PRIMARY KEY
user_id | INT(11) | NOT NULL
path | VARCHAR(255) | NOT NULL
title | VARCHAR(255) | NOT NULL
start_time | INT(11) | NOT NULL
last_time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | sessionid

## UserProfilePhoto (table user_profile_photo)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
type | ENUM(6) | NOT NULL, DEFAULT VALUE 'upload'
value | VARCHAR(255) | NOT NULL
width | SMALLINT(6) | NOT NULL
height | SMALLINT(6) | NOT NULL
time | INT(11) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id

## UserRole (table user_role)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL
role | ENUM(9) | DEFAULT VALUE 'user'
field | VARCHAR(32) | NOT NULL

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
user |  | foreign.user_id => self.user_id

## UserSettings (table user_settings)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
type | VARCHAR(48) | NOT NULL, PRIMARY KEY
value | VARCHAR(48) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id, type

## Variables (table variables)

### Columns

Name | Type | Info
--- | --- | ---
type | ENUM(6) | NOT NULL, PRIMARY KEY, DEFAULT VALUE 'global'
name | VARCHAR(32) | NOT NULL, PRIMARY KEY
value | VARCHAR(255) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | type, name

## Visit (table visit)

### Columns

Name | Type | Info
--- | --- | ---
user_id | INT(11) | NOT NULL, PRIMARY KEY
object_type | VARCHAR(12) | NOT NULL, PRIMARY KEY
object_id | INT(11) | NOT NULL, PRIMARY KEY
time | INT(10) | NOT NULL

### Unique Constraints

Name | Columns
--- | ---
primary | user_id, object_type, object_id

Generated Fri Jun 20 14:46:33 2008 by DBICx::AutoDoc version 0.04