Skip to main content

Database description

note

Different databases have different data types. The following table presumes use of mysql/mariadb as an example.

activity

activity table records various actions of users, such as votes, etc.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIactivity id
created_attimestampYEScreate time
updated_attimestampYESupdate time
cancelled_attimestampYEScancelled time
user_idbigint(20)NOMULthe user ID that generated the activity or affected by the activity
trigger_user_idbigint(20)NOMUL0the trigger user ID that generated the activity or affected by the activity
object_idbigint(20)NOMUL0the object ID that affected by the activity
original_object_idbigint(20)NO0the original object ID that activity
activity_typeint(11)NOactivity type, correspond to config id
cancelledtinyint(4)NO0mark this activity if cancelled
rankint(11)NO0rank of current operating user affected
has_ranktinyint(4)NO0this activity has rank or not
revision_idbigint(20)NO0revision id

answer

answer table records the answer info.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIanswer id
created_attimestampNOCURRENT_TIMESTAMPcreate time
updated_attimestampYESupdate time
question_idbigint(20)NO0question id
user_idbigint(20)NOMUL0answer user id
last_edit_user_idbigint(20)NO0last edit user id
original_textmediumtextNOoriginal text
parsed_textmediumtextNOparsed text
statusint(11)NO1answer status(available: 1;deleted: 10)
adoptedint(11)NO1adopted (1 failed 2 adopted)
comment_countint(11)NO0comment count
vote_countint(11)NO0vote count
revision_idbigint(20)NO0revision id

collection

collection table records user collection about any object.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRI0collection id
created_attimestampNOCURRENT_TIMESTAMPcreated time
updated_attimestampNOCURRENT_TIMESTAMPupdated time
user_idbigint(20)NOMUL0user id
object_idbigint(20)NO0object id
user_collection_group_idbigint(20)NO0user collection group id

collection_group

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIid
created_attimestampNOCURRENT_TIMESTAMPcreated time
updated_attimestampNOCURRENT_TIMESTAMPupdated time
user_idbigint(20)NOMUL0user id
namevarchar(50)NOthe collection group name
default_groupint(11)NO1mark this group is default, default 1

comment

comment table records the comment about question or answer.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIcomment id
created_attimestampYEScreate time
updated_attimestampYESupdate time
user_idbigint(20)NO0user id
reply_user_idbigint(20)YESreply user id
reply_comment_idbigint(20)YESreply comment id
object_idbigint(20)NOMUL0object id
question_idbigint(20)NO0question id
vote_countint(11)NO0user vote amount
statustinyint(4)NO0comment status(available: 1;deleted: 10)
original_textmediumtextNOoriginal comment content
parsed_textmediumtextNOparsed comment content

config

config records the site configuration.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRIconfig id
keyvarchar(128)YESUNIthe config key
valuetextYESthe config value, custom data structures and types

meta

meta records some extra information about the object.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(10)NOPRIid
created_attimestampNOCURRENT_TIMESTAMPcreated time
updated_attimestampNOCURRENT_TIMESTAMPupdated time
object_idbigint(20)NOMUL0object id
keyvarchar(100)NOkey
valuemediumtextNOvalue

notification

notification table records the notification that user received.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRInotification id
created_attimestampYEScreate time
updated_attimestampYESupdate time
user_idbigint(20)NOMUL0user id
object_idbigint(20)NOMUL0object id
contenttextNOnotification content
typeint(11)NO0notification type(1:inbox; 2:achievement)
is_readint(11)NO1read status(unread: 1; read 2)
statusint(11)NO1notification status(normal: 1;delete 2)

power

power table records all permissions

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRI
created_attimestampYEScreate time
updated_attimestampYESupdate time
namevarchar(50)NOname
power_typevarchar(100)NOpower type
descriptionvarchar(200)NOdescription

question

question table records the question info.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIquestion id
created_attimestampNOCURRENT_TIMESTAMPcreate time
updated_attimestampNOCURRENT_TIMESTAMPupdate time
user_idbigint(20)NOMUL0user id
last_edit_user_idbigint(20)NO0last edit user id
titlevarchar(150)NOquestion title
original_textmediumtextNOoriginal text
parsed_textmediumtextNOparsed text
statusint(11)NO1question status(available: 1;deleted: 10)
view_countint(11)NO0view count
unique_view_countint(11)NO0unique view count
vote_countint(11)NO0vote count
answer_countint(11)NO0answer count
collection_countint(11)NO0collection count
follow_countint(11)NO0follow count
accepted_answer_idbigint(20)NO0accepted answer id
last_answer_idbigint(20)NO0last answer id
post_update_timetimestampYESCURRENT_TIMESTAMPanswer the last update time
revision_idbigint(20)NO0revision id

report

report table records the content of user reports

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIid
created_attimestampYEScreate time
updated_attimestampYESupdate time
user_idbigint(20)NOreporter user id
object_idbigint(20)NOobject id
reported_user_idbigint(20)NO0reported user id
object_typeint(11)NO0revision type
report_typeint(11)NO0report type
contenttextNOreport content
flagged_typeint(11)NO0flagged type
flagged_contenttextYESflagged content
statusint(11)NO1status(normal: 1; pending:2; delete: 10)

revision

revision table records the object revision and the content of the version.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIid
created_attimestampYEScreate time
updated_attimestampYESupdate time
user_idbigint(20)NO0user id
object_typeint(11)NO0revision type(question: 1; answer 2; tag 3)
object_idbigint(20)NOMUL0object id
titlevarchar(255)NOtitle
contenttextNOcontent
logvarchar(255)YESlog
statusint(11)NO1revision status(normal: 1; delete 2)
review_user_idbigint(20)NO0review user id

role

role table records all roles

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRI
created_attimestampYEScreate time
updated_attimestampYESupdate time
namevarchar(50)NOname
descriptionvarchar(200)NOdescription

role_power_rel

role_power_rel records the relationship between roles and powers

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRI
created_attimestampYEScreate time
updated_attimestampYESupdate time
role_idint(11)NO0role id
power_typevarchar(200)NOpower

site_info

site_info table records the site information about interface or something related

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRIid
created_attimestampYEScreate time
updated_attimestampYESupdate time
typevarchar(64)NOtype
contentmediumtextNOcontent
statusint(11)NO1site info status(available: 1;deleted: 10)

tag

tag table records the tag information.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRItag_id
created_attimestampYEScreate time
updated_attimestampYESupdate time
main_tag_idbigint(20)NO0main tag id
main_tag_slug_namevarchar(35)NOmain tag slug name
slug_namevarchar(35)NOUNIslug name
display_namevarchar(35)NOdisplay name
original_textmediumtextNOoriginal comment content
parsed_textmediumtextNOparsed comment content
follow_countint(11)NO0associated follow count
question_countint(11)NO0associated question count
statusint(11)NO1tag status(available: 1;deleted: 10)
revision_idbigint(20)NO0revision id

tag_rel

tag_rel table records the relationship between objects and tags

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRItag_list_id
created_attimestampYEScreate time
updated_attimestampYESupdate time
object_idbigint(20)NOMULobject_id
tag_idbigint(20)NOMULtag_id
statusint(11)NO1tag_list_status(available: 1;deleted: 10)

uniqid

uniqid table recorded the object_id that can uniquely identify an object.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIuniqid_id
uniqid_typeint(11)NO0uniqid_type

user

The user table recorded basic information about the user.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idbigint(20)NOPRIuser id
created_attimestampYEScreate time
updated_attimestampYESupdate time
suspended_attimestampYESsuspended time
deleted_attimestampYESdelete time
last_login_datetimestampYESlast login date
usernamevarchar(50)NOUNIusername
passvarchar(255)NOpassword
e_mailvarchar(100)NOemail
mail_statustinyint(4)NO2mail status(1 pass 2 to be verified)
notice_statusint(11)NO2notice status(1 on 2off)
follow_countint(11)NO0follow count
answer_countint(11)NO0answer count
question_countint(11)NO0question count
rankint(11)NO0rank
statusint(11)NO1user status(available: 1; deleted: 10)
authority_groupint(11)NO1authority group
display_namevarchar(30)NOdisplay name
avatarvarchar(255)NOavatar
mobilevarchar(20)NOmobile
biotextNObio markdown
bio_htmltextNObio html
websitevarchar(255)NOwebsite
locationvarchar(100)NOlocation
ip_infovarchar(255)NOip info
is_adminint(11)NO0admin flag(deprecated)

user_role_rel

The user_role_rel table records the relationship between users and roles.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRI
created_attimestampYEScreate time
updated_attimestampYESupdate time
user_idbigint(20)NO0user id
role_idint(11)NO0role id

version

The version of the current answer is recorded in version table for upgrade.

COLUMNDATA TYPENULLABLEKEYDEFAULTCOMMENT
idint(11)NOPRIid
version_numberint(11)NO0version_number