migrations even though there's no migration system

This commit is contained in:
flash 2016-07-27 01:02:42 +02:00
parent 8f84d1eedc
commit 10d5976997
7 changed files with 3344 additions and 43 deletions

View file

@ -17,5 +17,5 @@ use \Illuminate\Database\Capsule\Manager;
*/
class DB extends Manager
{
// This class solely exists as an alias (for now at least)
// This class solely exists as an alias
}

View file

@ -0,0 +1,941 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
// this is based on what is in the live flashii table at the
// moment this migration was created to avoid merge conflicts.
class BaseTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('actioncodes', function (Blueprint $table) {
$table->string('code_action', 255)
->comment('Action identifier so the backend knows what to do.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user that would be affected by this action');
$table->string('action_code', 255)
->comment('The URL key for using this code.');
});
Schema::create('apikeys', function (Blueprint $table) {
$table->bigIncrements('id', 128)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->bigInteger('owner', 128)
->unsigned()
->comment('ID of user that owns this API key.');
$table->string('apikey', 32)
->comment('The API key.');
});
Schema::create('bans', function (Blueprint $table) {
$table->bigIncrements('ban_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of user that was banned, 0 for just an IP ban.');
$table->integer('ban_begin', 11)
->unsigned()
->comment('Timestamp when the user was banned.');
$table->integer('ban_end', 11)
->unsigned()
->comment('Timestamp when the user should regain access to the site.');
$table->string('ban_reason', 512)
->nullable()
->default(null)
->comment('Reason given for the ban.');
$table->bigInteger('ban_moderator', 255)
->unsigned()
->comment('ID of moderator that banned this user,');
});
Schema::create('comment_votes', function (Blueprint $table) {
$table->bigInteger('vote_comment', 255)
->unsigned()
->comment('ID of the comment that was voted on.');
$table->bigInteger('vote_user', 255)
->unsigned()
->comment('ID of the voter.');
$table->tinyInteger('vote_state', 1)
->unsigned()
->comment('0 = dislike, 1 = like.');
});
Schema::create('comments', function (Blueprint $table) {
$table->bigIncrements('comment_id', 255)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->string('comment_category', 32)
->comment('Comment category.');
$table->integer('comment_timestamp', 11)
->unsigned()
->comment('Timestamp of when this comment was posted.');
$table->bigInteger('comment_poster', 255)
->unsigned()
->comment('User ID of the poster.');
$table->bigInteger('comment_reply_to', 255)
->unsigned()
->default(0)
->comment('ID of the comment this comment is a reply to');
$table->text('comment_text', 255)
->comment('Content of the comment.');
});
Schema::create('config', function (Blueprint $table) {
$table->string('config_name', 255)
->unique()
->comment('Array key for configuration value');
$table->string('config_value', 255)
->comment('The value, obviously.');
});
Schema::create('emoticons', function (Blueprint $table) {
$table->string('emote_string', 255)
->comment('String to catch and replace');
$table->string('emote_path', 255)
->comment('Path to the image file relative to the content domain.');
});
Schema::create('error_log', function (Blueprint $table) {
$table->string('error_id', 32)
->comment('An ID that is created when an error occurs.');
$table->string('error_timestamp', 128)
->comment('A datestring from when the error occurred.');
$table->integer('error_revision', 16)
->unsigned()
->comment('Sakura Revision number.');
$table->integer('error_type', 16)
->unsigned()
->comment('The PHP error type of this error.');
$table->integer('error_line', 32)
->unsigned()
->comment('The line that caused this error.');
$table->string('error_string', 512)
->comment("PHP's description of this error.");
$table->string('error_file', 512)
->comment('The file in which this error occurred.');
$table->text('error_backtrace')
->comment('A full base64 and json encoded backtrace containing all environment data.');
});
Schema::create('faq', function (Blueprint $table) {
$table->bigIncrements('faq_id', 128)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->string('faq_shorthand', 255)
->comment('Used for linking directly to a question.');
$table->string('faq_question', 255)
->comment('The question.');
$table->text('faq_answer')
->comment('The answer.');
});
Schema::create('forum_permissions', function (Blueprint $table) {
$table->bigInteger('forum_id', 255)
->unsigned()
->comment('Forum ID');
$table->bigInteger('rank_id', 128)
->unsigned()
->comment('Rank ID, leave 0 for a user');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('User ID, leave 0 for a rank');
$table->string('forum_perms', 255)
->comment('Forum action permission string');
});
Schema::create('forums', function (Blueprint $table) {
$table->bigIncrements('forum_id', 255)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->bigInteger('forum_order', 255)
->unsigned()
->comment('Forum sorting order.');
$table->string('forum_name', 255)
->comment('Display name of the forum.');
$table->text('forum_desc')
->comment('Description of the forum.');
$table->string('forum_link', 255)
->comment('If set forum will display as a link.');
$table->bigInteger('forum_category', 255)
->unsigned()
->default(0)
->comment('ID of the category this forum falls under.');
$table->tinyInteger('forum_type', 4)
->unsigned()
->default(0)
->comment('Forum type, 0 for regular board, 1 for category and 2 for link.');
$table->string('forum_icon', 255)
->comment('Display icon for the forum.');
});
Schema::create('friends', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user that added the friend.');
$table->bigInteger('friend_id', 255)
->unsigned()
->comment('ID of the user that was added as a friend.');
$table->integer('friend_timestamp', 11)
->unsigned()
->comment('Timestamp of action.');
});
Schema::create('infopages', function (Blueprint $table) {
$table->string('page_shorthand', 255)
->comment('Name used for calling this page up in the /r/URL');
$table->string('page_title', 255)
->comment('Title displayed on the top of the page');
$table->text('page_content')
->comment('Content of the page');
});
Schema::create('login_attempts', function (Blueprint $table) {
$table->bigIncrements('attempt_id', 255)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->tinyInteger('attempt_success', 1)
->unsigned()
->comment('Success boolean.');
$table->integer('attempt_timestamp', 11)
->unsigned()
->comment('Unix timestamp of the event.');
$table->string('attempt_ip', 255)
->comment('IP that made this attempt.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user that was attempted to log in to.');
});
Schema::create('messages', function (Blueprint $table) {
$table->bigIncrements('id', 128)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->bigInteger('from_user', 255)
->unsigned()
->comment('ID of the user that sent this message.');
$table->bigInteger('to_user', 255)
->unsigned()
->comment('ID of user that should receive this message.');
$table->string('read', 255)
->comment('IDs of users who read this message.');
$table->string('deleted', 255)
->comment('Indicator if one of the parties deleted the message, if it is already 1 the script will remove this row.');
$table->integer('timestamp', 11)
->unsigned()
->comment('Timestamp of the time this message was sent');
$table->string('subject', 255)
->comment('Title of the message');
$table->text('content')
->comment('Contents of the message.');
});
Schema::create('news', function (Blueprint $table) {
$table->bigIncrements('news_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->string('news_category', 255)
->comment('Category ID.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of user who posted this news message.');
$table->integer('news_timestamp', 11)
->unsigned()
->comment('News post timestamp.');
$table->string('news_title', 255)
->comment('Title of the post.');
$table->text('news_content')
->comment('Contents of the post');
});
Schema::create('notifications', function (Blueprint $table) {
$table->bigIncrements('alert_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->bigInteger('user_id', 255)
->unsigned()
->default(0)
->comment('User ID this notification is intended for.');
$table->integer('alert_timestamp', 11)
->unsigned()
->default(0)
->comment('Timestamp when this notification was created.');
$table->tinyInteger('alert_read', 1)
->unsigned()
->default(0)
->comment('Toggle for unread and read.');
$table->tinyInteger('alert_sound', 1)
->unsigned()
->default(0)
->comment('Toggle if a sound should be played upon receiving the notification.');
$table->string('alert_title', 255)
->comment('Title displayed on the notification.');
$table->string('alert_text', 255)
->comment('Text displayed.');
$table->string('alert_link', 255)
->comment('Link (empty for no link).');
$table->string('alert_img', 255)
->comment('Image path, prefix with font: to use a font class instead of an image.');
$table->integer('alert_timeout', 16)
->unsigned()
->default(0)
->comment('How long the notification should stay on screen in milliseconds, 0 for forever.');
});
Schema::create('optionfields', function (Blueprint $table) {
$table->string('option_id', 255)
->unique()
->comment('Unique identifier for accessing this option.');
$table->string('option_name', 255)
->comment('Description of the field in a proper way.');
$table->string('option_description', 255)
->comment('Longer description of the option.');
$table->string('option_type', 255)
->comment('Type attribute in the input element.');
$table->string('option_permission', 255)
->comment('The minimum permission level this option requires.');
});
Schema::create('permissions', function (Blueprint $table) {
$table->bigInteger('rank_id', 255)
->unsigned()
->default(0)
->comment('ID of the rank this permissions set is used for.');
$table->bigInteger('user_id', 255)
->unsigned()
->default(0)
->comment('ID of the user this permissions set is used for.');
$table->string('permissions_site', 255)
->default(0)
->comment('Site permissions.');
$table->string('permissions_manage', 255)
->default(0)
->comment('Site management permissions');
});
Schema::create('posts', function (Blueprint $table) {
$table->bigIncrements('post_id', 255)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->bigInteger('topic_id', 255)
->unsigned()
->default(0)
->comment('ID of topic this post is a part of.');
$table->bigInteger('forum_id', 255)
->unsigned()
->default(0)
->comment('ID of forum this was posted in.');
$table->bigInteger('poster_id', 255)
->unsigned()
->default(0)
->comment('ID of poster of this post.');
$table->string('poster_ip', 40)
->comment('IP of poster.');
$table->integer('post_time', 11)
->unsigned()
->default(0)
->comment('Time this post was made.');
$table->string('post_subject', 255)
->comment('Subject of the post.');
$table->text('post_text')
->comment('Contents of the post.');
$table->integer('post_edit_time', 11)
->unsigned()
->default(0)
->comment('Time this post was last edited.');
$table->string('post_edit_reason', 255)
->comment('Reason this was edited.');
// yup, integer, despite being bigint every else >.>
$table->integer('post_edit_user', 255)
->unsigned()
->default(0)
->comment('ID of user that edited.');
});
Schema::create('premium', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned()
->unique()
->comment('ID of the user that purchased Tenshi.');
$table->integer('premium_start', 11)
->unsigned()
->comment('Timestamp of first purchase.');
$table->integer('premium_expire', 11)
->unsigned()
->comment('Expiration timestamp.');
});
Schema::create('premium_log', function (Blueprint $table) {
$table->increments('transaction_id', 16)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('User ID of purchaser');
$table->float('transaction_amount')
->comment('Amount that was transferred.');
$table->integer('transaction_date', 11)
->unsigned()
->comment('Date when the purchase was made.');
$table->string('transaction_comment', 255)
->comment('A short description of the action taken.');
});
Schema::create('profilefields', function (Blueprint $table) {
$table->increments('field_id', 64)
->unsigned()
->comment('ID used for ordering on the userpage.');
$table->string('field_name', 255)
->comment('Name of the field.');
$table->string('field_type', 255)
->comment('Type attribute in the input element.');
$table->tinyInteger('field_link', 1)
->unsigned()
->comment('Set if this value should be put in a href.');
$table->string('field_linkformat', 255)
->comment('If the form is a link how should it be formatted? {{ VAL }} gets replace with the value.');
$table->string('field_description', 255)
->comment('Description of the field displayed in the control panel.');
$table->string('field_additional', 255)
->comment('Undocumented JSON array containing special options if needed (probably only going to be used for the YouTube field).');
});
Schema::create('ranks', function (Blueprint $table) {
$table->bigIncrements('rank_id', 128)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->integer('rank_hierarchy', 11)
->unsigned()
->comment('Rank hierarchy.');
$table->string('rank_name', 255)
->comment('Display name of the rank.');
$table->string('rank_multiple', 10)
->nullable()
->default(null)
->comment('Used when addressing this rank as a multiple');
$table->tinyInteger('rank_hidden', 1)
->unsigned()
->default(0)
->comment("Don't show any public links to this rank.");
$table->string('rank_colour', 255)
->comment('Colour used for the username of a member of this rank.');
$table->text('rank_description')
->comment('A description of what a user of this rank can do/is supposed to do.');
$table->string('rank_title', 64)
->comment('Default user title if user has none set.');
});
Schema::create('reports', function (Blueprint $table) {
$table->bigIncrements('id', 255)
->unsigned()
->comment('MySQL Generated ID used for sorting.');
$table->integer('type', 32)
->unsigned()
->comment('Report type, entirely handled on the script side.');
$table->bigInteger('issuer', 255)
->unsigned()
->comment('ID of the person who issued this report.');
// what the fuck
$table->bigInteger('subject', 255)
->unsigned()
->comment("ID pointing out what was reported (a more accurate description isn't possible due to the type column).");
$table->string('title', 255)
->comment('A quick description of this report.');
$table->text('description')
->comment('And a detailed description.');
$table->bigInteger('reviewed', 255)
->unsigned()
->default(0)
->comment('ID of the moderator that reviewed this report.');
});
Schema::create('sessions', function (Blueprint $table) {
$table->bigIncrements('session_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management. ');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user this session is spawned for. ');
$table->string('user_ip', 255)
->comment('IP of the user this session is spawned for.');
$table->string('user_agent', 255)
->nullable()
->default(null)
->comment('User agent of the user this session is spawned for.');
$table->string('session_key', 255)
->comment("Session key, allow direct access to the user's account. ");
$table->integer('session_start', 16)
->unsigned()
->comment('The timestamp for when the session was started. ');
$table->integer('session_expire', 16)
->unsigned()
->comment('The timestamp for when this session should end, -1 for permanent. ');
$table->tinyInteger('session_remember', 1)
->unsigned()
->default(0)
->comment('If set to 1 session will be extended each time a page is loaded.');
});
Schema::create('topics', function (Blueprint $table) {
$table->bigIncrements('topic_id', 255)
->unsigned()
->comment('ID of forum this topic was created in.');
$table->bigInteger('forum_id', 255)
->unsigned()
->default(0)
->comment('ID of forum this topic was created in.');
$table->tinyInteger('topic_hidden', 1)
->unsigned()
->default(0)
->comment('Boolean to set the topic as hidden.');
$table->string('topic_title', 255)
->comment('Title of the topic.');
$table->integer('topic_time', 11)
->unsigned()
->default(0)
->comment('Timestamp when the topic was created.');
$table->integer('topic_time_limit', 11)
->unsigned()
->default(0)
->comment('After how long a topic should be locked.');
$table->bigInteger('topic_views', 255)
->unsigned()
->default(0)
->comment('Amount of times the topic has been viewed.');
$table->tinyInteger('topic_status', 3)
->unsigned()
->default(0)
->comment('Status of topic.');
$table->integer('topic_status_change', 11)
->unsigned()
->default(0)
->comment('Date the topic status was changed (used for deletion cooldown as well).');
$table->tinyInteger('topic_type', 3)
->unsigned()
->default(0)
->comment('Type of the topic.');
$table->integer('topic_last_reply', 11)
->unsigned()
->default(0)
->comment('Timestamp of when the last reply made to this thread.');
$table->bigInteger('topic_old_forum', 255)
->unsigned()
->default(0)
->comment('Pre-move forum id.');
});
Schema::create('topics_track', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user this row applies to.');
$table->bigInteger('topic_id', 255)
->unsigned()
->comment('ID of the thread in question.');
$table->bigInteger('forum_id', 255)
->unsigned()
->comment('ID of the forum in question.');
$table->integer('mark_time', 11)
->unsigned()
->default(0)
->comment('Timestamp of the event.');
});
Schema::create('uploads', function (Blueprint $table) {
$table->bigIncrements('file_id', 255)
->unsigned()
->comment('Automatically generated value for management');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of the user that uploaded the file');
// this one's actually longblob
$table->binary('file_data')
->comment('Contents of the file');
$table->string('file_name', 255)
->comment('Name of the file');
$table->string('file_mime', 255)
->comment('Static mime type of the file');
$table->integer('file_time', 11)
->unsigned()
->comment('Timestamp of when the file was uploaded');
$table->integer('file_expire', 11)
->unsigned()
->comment('When should the file be removed, 0 for never');
});
Schema::create('user_optionfields', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned()
->comment('User this field applies to');
$table->string('field_name', 255)
->comment('Identifier of the field');
$table->string('field_value', 255)
->comment('Value of the field');
});
Schema::create('user_profilefields', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned()
->comment('User this field applies to');
$table->string('field_name', 255)
->comment('Identifier of the field');
$table->string('field_value', 255)
->comment('Value of the field');
});
Schema::create('user_ranks', function (Blueprint $table) {
$table->bigInteger('user_id', 255)
->unsigned();
$table->bigInteger('rank_id', 128)
->unsigned();
});
Schema::create('username_history', function (Blueprint $table) {
$table->increments('change_id', 11)
->unsigned()
->comment('Identifier');
$table->integer('change_time', 11)
->unsigned()
->comment('Timestamp of change');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('User ID');
$table->string('username_new', 255)
->comment('New username');
$table->string('username_new_clean', 255)
->comment('Clean new username');
$table->string('username_old', 255)
->comment('Old username');
$table->string('username_old_clean', 255)
->comment('Clean old username');
});
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('user_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management. ');
$table->string('username', 255)
->comment('Username set at registration.');
$table->string('username_clean', 255)
->unique()
->comment('A more cleaned up version of the username for backend usage.');
$table->string('password_hash', 255)
->comment('Hashing algo used for the password hash.');
$table->string('password_salt', 255)
->comment('Salt used for the password hash.');
$table->string('password_algo', 255)
->comment('Algorithm used for the password hash.');
$table->integer('password_iter', 11)
->unsigned()
->comment('Password hash iterations.');
$table->integer('password_chan', 11)
->unsigned()
->default(0)
->comment('Last time the user changed their password.');
$table->string('email', 255)
->comment('E-mail of the user for password restoring etc.');
$table->mediumInteger('rank_main', 4)
->unsigned()
->default(0)
->comment('Main rank of the user.');
$table->string('user_colour', 255)
->nullable()
->default(null)
->comment('Additional name colour, when empty colour defaults to group colour.');
$table->string('register_ip', 255)
->comment('IP used for the creation of this account.');
$table->string('last_ip', 255)
->comment('Last IP that was used to log into this account.');
$table->string('user_title', 64)
->nullable()
->default(null)
->comment('Custom user title of the user, when empty reverts to their derault group name.');
$table->integer('user_register', 11)
->unsigned()
->default(0)
->comment('Timestamp of account creation.');
$table->integer('user_last_online', 11)
->unsigned()
->default(0)
->comment('Last time anything was done on this account.');
$table->date('user_birthday')
->default('0000-00-00')
->comment('Birthdate of the user.');
$table->char('user_country', 2)
->default('XX')
->comment("Contains ISO 3166 country code of user's registration location.");
$table->bigInteger('user_avatar', 255)
->unsigned()
->default(0)
->comment('ID of the avatar in the uploads table.');
$table->bigInteger('user_background', 255)
->unsigned()
->default(0)
->comment('ID of the background in the uploads table.');
$table->bigInteger('user_header', 255)
->unsigned()
->default(0)
->comment('ID of the profile header in the uploads table.');
$table->longText('user_page')
->comment('Contents of the userpage.');
$table->text('user_signature')
->comment('Signature displayed below forum posts.');
$table->string('password', 255)
->nullable()
->default(null);
});
Schema::create('warnings', function (Blueprint $table) {
$table->bigIncrements('warning_id', 255)
->unsigned()
->comment('Automatically generated ID by MySQL for management.');
$table->bigInteger('user_id', 255)
->unsigned()
->comment('ID of user that was warned.');
$table->bigInteger('moderator_id', 255)
->unsigned()
->comment('ID of the user that issued the warning.');
$table->integer('warning_issued', 16)
->unsigned()
->comment('Timestamp of the date the warning was issued.');
$table->integer('warning_expires', 16)
->unsigned()
->comment('Timstamp when the warning should expire, 0 for a permanent warning.');
$table->tinyInteger('warning_action', 1)
->unsigned()
->nullable()
->default(null)
->comment('Action taken.');
$table->string('warning_reason', 512)
->nullable()
->default(null)
->comment('Reason for the warning.');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('actioncodes');
Schema::drop('apikeys');
Schema::drop('bans');
Schema::drop('comment_votes');
Schema::drop('comments');
Schema::drop('config');
Schema::drop('emoticons');
Schema::drop('faq');
Schema::drop('forum_permissions');
Schema::drop('forums');
Schema::drop('friends');
Schema::drop('infopages');
Schema::drop('login_attempts');
Schema::drop('messages');
Schema::drop('news');
Schema::drop('notifications');
Schema::drop('optionfields');
Schema::drop('permissions');
Schema::drop('posts');
Schema::drop('premium');
Schema::drop('premium_log');
Schema::drop('profilefields');
Schema::drop('ranks');
Schema::drop('reports');
Schema::drop('sessions');
Schema::drop('topics');
Schema::drop('topics_track');
Schema::drop('uploads');
Schema::drop('user_optionfields');
Schema::drop('user_profilefields');
Schema::drop('user_ranks');
Schema::drop('username_history');
Schema::drop('users');
Schema::drop('warnings');
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,436 @@
SET NAMES utf8;
SET time_zone = '+00:00';
DROP TABLE IF EXISTS `osulb_scores`;
CREATE TABLE `osulb_scores` (
`osu_id` bigint(255) unsigned NOT NULL,
`fii_id` bigint(255) unsigned NOT NULL,
`last_update` int(11) unsigned NOT NULL,
`osu_name` varchar(16) COLLATE utf8_bin NOT NULL,
`fii_name` varchar(16) COLLATE utf8_bin NOT NULL,
`osu_mode` tinyint(1) unsigned NOT NULL,
`osu_count300` int(11) unsigned NOT NULL,
`osu_count100` int(11) unsigned NOT NULL,
`osu_count50` int(11) unsigned NOT NULL,
`osu_playcount` int(11) unsigned NOT NULL,
`osu_ranked_score` bigint(255) unsigned NOT NULL,
`osu_total_score` bigint(255) unsigned NOT NULL,
`osu_pp_rank` bigint(255) unsigned NOT NULL,
`osu_level` float unsigned NOT NULL,
`osu_pp_raw` float unsigned NOT NULL,
`osu_accuracy` float NOT NULL,
`osu_count_rank_ss` int(11) NOT NULL,
`osu_count_rank_s` int(11) NOT NULL,
`osu_count_rank_a` int(11) NOT NULL,
`osu_country` char(2) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_actioncodes`;
CREATE TABLE `sakura_actioncodes` (
`code_action` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Action identifier so the backend knows what to do.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that would be affected by this action',
`action_code` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The URL key for using this code.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_apikeys`;
CREATE TABLE `sakura_apikeys` (
`id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`owner` bigint(128) unsigned NOT NULL COMMENT 'ID of user that owns this API key.',
`apikey` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'The API key.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_bans`;
CREATE TABLE `sakura_bans` (
`ban_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of user that was banned, 0 for just an IP ban.',
`ban_begin` int(11) unsigned NOT NULL COMMENT 'Timestamp when the user was banned.',
`ban_end` int(11) unsigned NOT NULL COMMENT 'Timestamp when the user should regain access to the site.',
`ban_reason` varchar(512) COLLATE utf8_bin DEFAULT NULL COMMENT 'Reason given for the ban.',
`ban_moderator` bigint(255) unsigned NOT NULL COMMENT 'ID of moderator that banned this user,',
PRIMARY KEY (`ban_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_comments`;
CREATE TABLE `sakura_comments` (
`comment_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`comment_category` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'Comment category.',
`comment_timestamp` int(11) unsigned NOT NULL COMMENT 'Timestamp of when this comment was posted.',
`comment_poster` bigint(255) unsigned NOT NULL COMMENT 'User ID of the poster.',
`comment_reply_to` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the comment this comment is a reply to',
`comment_text` text COLLATE utf8_bin NOT NULL COMMENT 'Content of the comment.',
PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_comment_votes`;
CREATE TABLE `sakura_comment_votes` (
`vote_comment` bigint(255) unsigned NOT NULL COMMENT 'ID of the comment that was voted on.',
`vote_user` bigint(255) unsigned NOT NULL COMMENT 'ID of the voter.',
`vote_state` tinyint(1) unsigned NOT NULL COMMENT '0 = dislike, 1 = like.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_config`;
CREATE TABLE `sakura_config` (
`config_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Array key for configuration value',
`config_value` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The value, obviously.',
UNIQUE KEY `config_name` (`config_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_emoticons`;
CREATE TABLE `sakura_emoticons` (
`emote_string` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'String to catch and replace',
`emote_path` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Path to the image file relative to the content domain.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_error_log`;
CREATE TABLE `sakura_error_log` (
`error_id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'An ID that is created when an error occurs.',
`error_timestamp` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'A datestring from when the error occurred.',
`error_revision` int(16) unsigned NOT NULL COMMENT 'Sakura Revision number.',
`error_type` int(16) unsigned NOT NULL COMMENT 'The PHP error type of this error.',
`error_line` int(32) unsigned NOT NULL COMMENT 'The line that caused this error.',
`error_string` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'PHP''s description of this error.',
`error_file` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'The file in which this error occurred.',
`error_backtrace` text COLLATE utf8_bin NOT NULL COMMENT 'A full base64 and json encoded backtrace containing all environment data.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_faq`;
CREATE TABLE `sakura_faq` (
`faq_id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`faq_shorthand` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Used for linking directly to a question.',
`faq_question` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The question.',
`faq_answer` text COLLATE utf8_bin NOT NULL COMMENT 'The answer.',
PRIMARY KEY (`faq_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_forums`;
CREATE TABLE `sakura_forums` (
`forum_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`forum_order` bigint(255) unsigned NOT NULL COMMENT 'Forum sorting order.',
`forum_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display name of the forum.',
`forum_desc` text COLLATE utf8_bin NOT NULL COMMENT 'Description of the forum.',
`forum_link` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'If set forum will display as a link.',
`forum_category` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the category this forum falls under.',
`forum_type` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Forum type, 0 for regular board, 1 for category and 2 for link.',
`forum_icon` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display icon for the forum.',
PRIMARY KEY (`forum_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_forum_permissions`;
CREATE TABLE `sakura_forum_permissions` (
`forum_id` bigint(255) unsigned NOT NULL COMMENT 'Forum ID',
`rank_id` bigint(128) unsigned NOT NULL COMMENT 'Rank ID, leave 0 for a user',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'User ID, leave 0 for a rank',
`forum_perms` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Forum action permission string'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_friends`;
CREATE TABLE `sakura_friends` (
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that added the friend.',
`friend_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that was added as a friend.',
`friend_timestamp` int(11) unsigned NOT NULL COMMENT 'Timestamp of action.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_infopages`;
CREATE TABLE `sakura_infopages` (
`page_shorthand` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Name used for calling this page up in the /r/URL',
`page_title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title displayed on the top of the page',
`page_content` text COLLATE utf8_bin NOT NULL COMMENT 'Content of the page'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_login_attempts`;
CREATE TABLE `sakura_login_attempts` (
`attempt_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`attempt_success` tinyint(1) unsigned NOT NULL COMMENT 'Success boolean.',
`attempt_timestamp` int(11) unsigned NOT NULL COMMENT 'Unix timestamp of the event.',
`attempt_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP that made this attempt.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that was attempted to log in to.',
PRIMARY KEY (`attempt_id`)
) ENGINE=InnoDB AUTO_INCREMENT=596 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_messages`;
CREATE TABLE `sakura_messages` (
`id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`from_user` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that sent this message.',
`to_user` bigint(255) unsigned NOT NULL COMMENT 'ID of user that should receive this message.',
`read` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IDs of users who read this message.',
`deleted` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Indicator if one of the parties deleted the message, if it is already 1 the script will remove this row.',
`timestamp` int(11) unsigned NOT NULL COMMENT 'Timestamp of the time this message was sent',
`subject` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title of the message',
`content` text COLLATE utf8_bin NOT NULL COMMENT 'Contents of the message.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_news`;
CREATE TABLE `sakura_news` (
`news_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`news_category` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Category ID.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of user who posted this news message.',
`news_timestamp` int(11) unsigned NOT NULL COMMENT 'News post timestamp.',
`news_title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title of the post.',
`news_content` text COLLATE utf8_bin NOT NULL COMMENT 'Contents of the post',
PRIMARY KEY (`news_id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_notifications`;
CREATE TABLE `sakura_notifications` (
`alert_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`user_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'User ID this notification is intended for.',
`alert_timestamp` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp when this notification was created.',
`alert_read` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Toggle for unread and read.',
`alert_sound` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Toggle if a sound should be played upon receiving the notification.',
`alert_title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title displayed on the notification.',
`alert_text` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Text displayed.',
`alert_link` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Link (empty for no link).',
`alert_img` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Image path, prefix with font: to use a font class instead of an image.',
`alert_timeout` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'How long the notification should stay on screen in milliseconds, 0 for forever.',
PRIMARY KEY (`alert_id`)
) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_optionfields`;
CREATE TABLE `sakura_optionfields` (
`option_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Unique identifier for accessing this option.',
`option_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Description of the field in a proper way.',
`option_description` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Longer description of the option.',
`option_type` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Type attribute in the input element.',
`option_permission` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The minimum permission level this option requires.',
UNIQUE KEY `id` (`option_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_permissions`;
CREATE TABLE `sakura_permissions` (
`rank_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the rank this permissions set is used for.',
`user_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the user this permissions set is used for.',
`permissions_site` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '0' COMMENT 'Site permissions.',
`permissions_manage` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '0' COMMENT 'Site management permissions'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_posts`;
CREATE TABLE `sakura_posts` (
`post_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`topic_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of topic this post is a part of.',
`forum_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of forum this was posted in.',
`poster_id` bigint(255) unsigned DEFAULT '0' COMMENT 'ID of poster of this post.',
`poster_ip` varchar(40) COLLATE utf8_bin NOT NULL COMMENT 'IP of poster.',
`post_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Time this post was made.',
`post_subject` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Subject of the post.',
`post_text` text COLLATE utf8_bin NOT NULL COMMENT 'Contents of the post.',
`post_edit_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Time this post was last edited.',
`post_edit_reason` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Reason this was edited.',
`post_edit_user` int(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of user that edited.',
PRIMARY KEY (`post_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1208 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_premium`;
CREATE TABLE `sakura_premium` (
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that purchased Tenshi.',
`premium_start` int(11) unsigned NOT NULL COMMENT 'Timestamp of first purchase.',
`premium_expire` int(11) unsigned NOT NULL COMMENT 'Expiration timestamp.',
UNIQUE KEY `uid` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_premium_log`;
CREATE TABLE `sakura_premium_log` (
`transaction_id` int(16) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'User ID of purchaser',
`transaction_amount` float NOT NULL COMMENT 'Amount that was transferred.',
`transaction_date` int(11) unsigned NOT NULL COMMENT 'Date when the purchase was made.',
`transaction_comment` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'A short description of the action taken.',
PRIMARY KEY (`transaction_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_profilefields`;
CREATE TABLE `sakura_profilefields` (
`field_id` int(64) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID used for ordering on the userpage.',
`field_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Name of the field.',
`field_type` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Type attribute in the input element.',
`field_link` tinyint(1) unsigned NOT NULL COMMENT 'Set if this value should be put in a href.',
`field_linkformat` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'If the form is a link how should it be formatted? {{ VAL }} gets replace with the value.',
`field_description` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Description of the field displayed in the control panel.',
`field_additional` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Undocumented JSON array containing special options if needed (probably only going to be used for the YouTube field).',
PRIMARY KEY (`field_id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_ranks`;
CREATE TABLE `sakura_ranks` (
`rank_id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`rank_hierarchy` int(11) unsigned NOT NULL COMMENT 'Rank hierarchy.',
`rank_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display name of the rank.',
`rank_multiple` varchar(10) COLLATE utf8_bin DEFAULT NULL COMMENT 'Used when addressing this rank as a multiple',
`rank_hidden` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Don''t show any public links to this rank.',
`rank_colour` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Colour used for the username of a member of this rank.',
`rank_description` text COLLATE utf8_bin NOT NULL COMMENT 'A description of what a user of this rank can do/is supposed to do.',
`rank_title` varchar(64) COLLATE utf8_bin NOT NULL COMMENT 'Default user title if user has none set.',
PRIMARY KEY (`rank_id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_reports`;
CREATE TABLE `sakura_reports` (
`id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`type` int(32) unsigned NOT NULL COMMENT 'Report type, entirely handled on the script side.',
`issuer` bigint(255) unsigned NOT NULL COMMENT 'ID of the person who issued this report.',
`subject` bigint(255) unsigned NOT NULL COMMENT 'ID pointing out what was reported (a more accurate description isn''t possible due to the type column).',
`title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'A quick description of this report.',
`description` text COLLATE utf8_bin NOT NULL COMMENT 'And a detailed description.',
`reviewed` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the moderator that reviewed this report.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_sessions`;
CREATE TABLE `sakura_sessions` (
`session_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management. ',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user this session is spawned for. ',
`user_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP of the user this session is spawned for.',
`user_agent` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'User agent of the user this session is spawned for.',
`session_key` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Session key, allow direct access to the user''s account. ',
`session_start` int(16) unsigned NOT NULL COMMENT 'The timestamp for when the session was started. ',
`session_expire` int(16) unsigned NOT NULL COMMENT 'The timestamp for when this session should end, -1 for permanent. ',
`session_remember` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'If set to 1 session will be extended each time a page is loaded.',
PRIMARY KEY (`session_id`)
) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_topics`;
CREATE TABLE `sakura_topics` (
`topic_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`forum_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of forum this topic was created in.',
`topic_hidden` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Boolean to set the topic as hidden.',
`topic_title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title of the topic.',
`topic_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp when the topic was created.',
`topic_time_limit` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'After how long a topic should be locked.',
`topic_views` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'Amount of times the topic has been viewed.',
`topic_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Status of topic.',
`topic_status_change` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Date the topic status was changed (used for deletion cooldown as well).',
`topic_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Type of the topic.',
`topic_last_reply` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of when the last reply made to this thread.',
`topic_old_forum` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'Pre-move forum id.',
PRIMARY KEY (`topic_id`)
) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_topics_track`;
CREATE TABLE `sakura_topics_track` (
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user this row applies to.',
`topic_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the thread in question.',
`forum_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the forum in question.',
`mark_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of the event.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_uploads`;
CREATE TABLE `sakura_uploads` (
`file_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated value for management',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that uploaded the file',
`file_data` longblob,
`file_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Name of the file',
`file_mime` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Static mime type of the file',
`file_time` int(11) unsigned NOT NULL COMMENT 'Timestamp of when the file was uploaded',
`file_expire` int(11) unsigned NOT NULL COMMENT 'When should the file be removed, 0 for never',
PRIMARY KEY (`file_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_username_history`;
CREATE TABLE `sakura_username_history` (
`change_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier',
`change_time` int(11) unsigned NOT NULL COMMENT 'Timestamp of change',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'User ID',
`username_new` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'New username',
`username_new_clean` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Clean new username',
`username_old` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Old username',
`username_old_clean` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Clean old username',
PRIMARY KEY (`change_id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_users`;
CREATE TABLE `sakura_users` (
`user_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management. ',
`username` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Username set at registration.',
`username_clean` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'A more cleaned up version of the username for backend usage.',
`password_hash` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Hashing algo used for the password hash.',
`password_salt` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Salt used for the password hash.',
`password_algo` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Algorithm used for the password hash.',
`password_iter` int(11) unsigned NOT NULL COMMENT 'Password hash iterations.',
`password_chan` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Last time the user changed their password.',
`email` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'E-mail of the user for password restoring etc.',
`rank_main` mediumint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Main rank of the user.',
`user_colour` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Additional name colour, when empty colour defaults to group colour.',
`register_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP used for the creation of this account.',
`last_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Last IP that was used to log into this account.',
`user_title` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'Custom user title of the user, when empty reverts to their derault group name.',
`user_registered` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of account creation.',
`user_last_online` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Last time anything was done on this account.',
`user_birthday` date NOT NULL DEFAULT '0000-00-00' COMMENT 'Birthdate of the user.',
`user_country` char(2) COLLATE utf8_bin NOT NULL DEFAULT 'XX' COMMENT 'Contains ISO 3166 country code of user''s registration location.',
`user_avatar` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the avatar in the uploads table.',
`user_background` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the background in the uploads table.',
`user_header` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the profile header in the uploads table.',
`user_page` longtext COLLATE utf8_bin COMMENT 'Contents of the userpage.',
`user_signature` text COLLATE utf8_bin COMMENT 'Signature displayed below forum posts.',
`password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `username_clean` (`username_clean`)
) ENGINE=InnoDB AUTO_INCREMENT=481 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_user_optionfields`;
CREATE TABLE `sakura_user_optionfields` (
`user_id` bigint(255) unsigned NOT NULL COMMENT 'User this field applies to',
`field_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Identifier of the field',
`field_value` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Value of the field'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_user_profilefields`;
CREATE TABLE `sakura_user_profilefields` (
`user_id` bigint(255) unsigned NOT NULL COMMENT 'User this field applies to',
`field_name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Identifier of the field',
`field_value` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Value of the field'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_user_ranks`;
CREATE TABLE `sakura_user_ranks` (
`user_id` bigint(255) unsigned NOT NULL,
`rank_id` bigint(128) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_warnings`;
CREATE TABLE `sakura_warnings` (
`warning_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`user_id` bigint(255) unsigned NOT NULL COMMENT 'ID of user that was warned.',
`moderator_id` bigint(255) unsigned NOT NULL COMMENT 'ID of the user that issued the warning.',
`warning_issued` int(16) unsigned NOT NULL COMMENT 'Timestamp of the date the warning was issued.',
`warning_expires` int(16) unsigned NOT NULL COMMENT 'Timstamp when the warning should expire, 0 for a permanent warning.',
`warning_action` tinyint(1) unsigned DEFAULT NULL COMMENT 'Action taken.',
`warning_reason` varchar(512) COLLATE utf8_bin DEFAULT NULL COMMENT 'Reason for the warning.',
PRIMARY KEY (`warning_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View file

@ -4,17 +4,16 @@
* (c) 2013-2016 Julian van de Groep <http://flash.moe>
*/
// Declare namespace
namespace Sakura;
// Define Sakura version
// Define version and root path
define('SAKURA_VERSION', 20160726);
// Define Sakura Path
define('ROOT', __DIR__ . '/');
// Turn error reporting on for the initial startup sequence
error_reporting(-1);
// CLI mode
if (php_sapi_name() === 'cli') {
define('IN_CLI', true);
}
// Override expiration variables
ignore_user_abort(true);
@ -23,7 +22,7 @@ set_time_limit(0);
// Set internal encoding method
mb_internal_encoding('utf-8');
// Stop the execution if the PHP Version is older than 7.0.0
// Check the PHP version
if (version_compare(phpversion(), '7.0.0', '<')) {
throw new Exception('Sakura requires at least PHP 7.0.0, please upgrade to a newer PHP version.');
}
@ -33,52 +32,43 @@ if (!file_exists(ROOT . 'vendor/autoload.php')) {
throw new Exception('Autoloader not found, did you run composer install?');
}
// Require composer libraries
// Include the autoloader
require_once ROOT . 'vendor/autoload.php';
// Load the local configuration
// Load the configuration
Config::init(ROOT . 'config/config.ini');
// Set Error handler
set_error_handler('error_handler');
// Change error reporting according to the dev configuration
error_reporting(config('dev.show_errors') ? -1 : 0);
// Create a new database capsule
// Start the database module
$capsule = new DB;
// Add the connection
$capsule->addConnection(config('database'));
// Make the capsule globally accessible
$capsule->setAsGlobal();
// Start output buffering
ob_start(config('performance.compression') ? 'ob_gzhandler' : null);
if (!defined('IN_CLI')) {
// Start output buffering
ob_start(config('performance.compression') ? 'ob_gzhandler' : null);
// Initialise the router
Router::init();
// Initialise the router and include the routes file
Router::init();
include_once ROOT . 'routes.php';
// Include routes file
include_once ROOT . 'routes.php';
// Initialise the current session
$cookiePrefix = config('cookie.prefix');
ActiveUser::init(
intval($_COOKIE["{$cookiePrefix}id"] ?? 0),
$_COOKIE["{$cookiePrefix}session"] ?? ''
);
// Initialise the current session
$cookiePrefix = config('cookie.prefix');
// ActiveUser::init(
// intval($_COOKIE["{$cookiePrefix}id"] ?? 0),
// $_COOKIE["{$cookiePrefix}session"] ?? ''
// );
// Start templating engine
Template::set(config('general.design'));
// Set base page rendering data
Template::vars([
'get' => $_GET,
'user' => ActiveUser::$user,
'post' => $_POST,
'server' => $_SERVER,
'request' => $_REQUEST,
//'session' => $_SESSION,
]);
// Start templating engine and set base variables
Template::set(config('general.design'));
Template::vars([
'get' => $_GET,
'user' => ActiveUser::$user,
'post' => $_POST,
'server' => $_SERVER,
'request' => $_REQUEST,
//'session' => $_SESSION,
]);
}