mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 00:43:39 +08:00
Fix migrations to comply with PSR-2
This commit is contained in:
parent
803d446bbb
commit
fc20c0dd09
|
@ -3,30 +3,30 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateAccessTokensTable extends Migration {
|
class CreateAccessTokensTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('access_tokens', function(Blueprint $table)
|
Schema::create('access_tokens', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->string('id', 100)->primary();
|
$table->string('id', 100)->primary();
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('access_tokens');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('access_tokens');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,34 +3,34 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateActivityTable extends Migration {
|
class CreateActivityTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('activity', function(Blueprint $table)
|
Schema::create('activity', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
$table->integer('sender_id')->unsigned()->nullable();
|
$table->integer('sender_id')->unsigned()->nullable();
|
||||||
$table->string('type', 100);
|
$table->string('type', 100);
|
||||||
$table->binary('data')->nullable();
|
$table->binary('data')->nullable();
|
||||||
$table->dateTime('time');
|
$table->dateTime('time');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('activity');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('activity');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,30 +3,30 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateConfigTable extends Migration {
|
class CreateConfigTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('config', function(Blueprint $table)
|
Schema::create('config', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->string('key', 100)->primary();
|
$table->string('key', 100)->primary();
|
||||||
$table->binary('value')->nullable();
|
$table->binary('value')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('config');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('config');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,41 +3,41 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateDiscussionsTable extends Migration {
|
class CreateDiscussionsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('discussions', function(Blueprint $table)
|
Schema::create('discussions', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('title', 200);
|
$table->string('title', 200);
|
||||||
$table->integer('comments_count')->unsigned()->default(0);
|
$table->integer('comments_count')->unsigned()->default(0);
|
||||||
$table->integer('number_index')->unsigned()->default(0);
|
$table->integer('number_index')->unsigned()->default(0);
|
||||||
|
|
||||||
$table->dateTime('start_time');
|
$table->dateTime('start_time');
|
||||||
$table->integer('start_user_id')->unsigned()->nullable();
|
$table->integer('start_user_id')->unsigned()->nullable();
|
||||||
$table->integer('start_post_id')->unsigned()->nullable();
|
$table->integer('start_post_id')->unsigned()->nullable();
|
||||||
|
|
||||||
$table->dateTime('last_time')->nullable();
|
$table->dateTime('last_time')->nullable();
|
||||||
$table->integer('last_user_id')->unsigned()->nullable();
|
$table->integer('last_user_id')->unsigned()->nullable();
|
||||||
$table->integer('last_post_id')->unsigned()->nullable();
|
$table->integer('last_post_id')->unsigned()->nullable();
|
||||||
$table->integer('last_post_number')->unsigned()->nullable();
|
$table->integer('last_post_number')->unsigned()->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('discussions');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('discussions');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,37 +3,37 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateNotificationsTable extends Migration {
|
class CreateNotificationsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('notifications', function(Blueprint $table)
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
$table->integer('sender_id')->unsigned()->nullable();
|
$table->integer('sender_id')->unsigned()->nullable();
|
||||||
$table->string('type', 100);
|
$table->string('type', 100);
|
||||||
$table->string('subject_type', 200)->nullable();
|
$table->string('subject_type', 200)->nullable();
|
||||||
$table->integer('subject_id')->unsigned()->nullable();
|
$table->integer('subject_id')->unsigned()->nullable();
|
||||||
$table->binary('data')->nullable();
|
$table->binary('data')->nullable();
|
||||||
$table->dateTime('time');
|
$table->dateTime('time');
|
||||||
$table->boolean('is_read')->default(0);
|
$table->boolean('is_read')->default(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('notifications');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('notifications');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,31 +3,31 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreatePermissionsTable extends Migration {
|
class CreatePermissionsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('permissions', function($table)
|
Schema::create('permissions', function ($table) {
|
||||||
{
|
|
||||||
$table->integer('group_id')->unsigned();
|
$table->integer('group_id')->unsigned();
|
||||||
$table->string('permission', 100);
|
$table->string('permission', 100);
|
||||||
$table->primary(['group_id', 'permission']);
|
$table->primary(['group_id', 'permission']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('permissions');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('permissions');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,45 +3,45 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreatePostsTable extends Migration {
|
class CreatePostsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('posts', function(Blueprint $table)
|
Schema::create('posts', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->integer('discussion_id')->unsigned();
|
$table->integer('discussion_id')->unsigned();
|
||||||
$table->integer('number')->unsigned()->nullable();
|
$table->integer('number')->unsigned()->nullable();
|
||||||
|
|
||||||
$table->dateTime('time');
|
$table->dateTime('time');
|
||||||
$table->integer('user_id')->unsigned()->nullable();
|
$table->integer('user_id')->unsigned()->nullable();
|
||||||
$table->string('type', 100)->nullable();
|
$table->string('type', 100)->nullable();
|
||||||
$table->text('content')->nullable();
|
$table->text('content')->nullable();
|
||||||
$table->text('content_html')->nullable();
|
$table->text('content_html')->nullable();
|
||||||
|
|
||||||
$table->dateTime('edit_time')->nullable();
|
$table->dateTime('edit_time')->nullable();
|
||||||
$table->integer('edit_user_id')->unsigned()->nullable();
|
$table->integer('edit_user_id')->unsigned()->nullable();
|
||||||
$table->dateTime('hide_time')->nullable();
|
$table->dateTime('hide_time')->nullable();
|
||||||
$table->integer('hide_user_id')->unsigned()->nullable();
|
$table->integer('hide_user_id')->unsigned()->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
// add fulltext index to content (and title?)
|
// add fulltext index to content (and title?)
|
||||||
// add unique index on [discussion_id, number] !!!
|
// add unique index on [discussion_id, number] !!!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('posts');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('posts');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,33 +3,33 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateUsersDiscussionsTable extends Migration {
|
class CreateUsersDiscussionsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('users_discussions', function(Blueprint $table)
|
Schema::create('users_discussions', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
$table->integer('discussion_id')->unsigned();
|
$table->integer('discussion_id')->unsigned();
|
||||||
$table->dateTime('read_time')->nullable();
|
$table->dateTime('read_time')->nullable();
|
||||||
$table->integer('read_number')->unsigned()->nullable();
|
$table->integer('read_number')->unsigned()->nullable();
|
||||||
$table->primary(['user_id', 'discussion_id']);
|
$table->primary(['user_id', 'discussion_id']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('users_discussions');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('users_discussions');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,31 +3,31 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateUsersGroupsTable extends Migration {
|
class CreateUsersGroupsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('users_groups', function(Blueprint $table)
|
Schema::create('users_groups', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->integer('user_id')->unsigned();
|
$table->integer('user_id')->unsigned();
|
||||||
$table->integer('group_id')->unsigned();
|
$table->integer('group_id')->unsigned();
|
||||||
$table->primary(['user_id', 'group_id']);
|
$table->primary(['user_id', 'group_id']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::drop('users_groups');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('users_groups');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
class CreateUsersTable extends Migration {
|
class CreateUsersTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
|
@ -12,8 +13,8 @@ class CreateUsersTable extends Migration {
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('users', function(Blueprint $table)
|
Schema::create('users', function (Blueprint $table) {
|
||||||
{
|
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('username', 100)->unique();
|
$table->string('username', 100)->unique();
|
||||||
$table->string('email', 150)->unique();
|
$table->string('email', 150)->unique();
|
||||||
|
@ -43,5 +44,4 @@ class CreateUsersTable extends Migration {
|
||||||
{
|
{
|
||||||
Schema::drop('users');
|
Schema::drop('users');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user