Fix migrations to comply with PSR-2

This commit is contained in:
Franz Liedke 2015-05-19 01:22:09 +02:00
parent 803d446bbb
commit fc20c0dd09
10 changed files with 256 additions and 256 deletions

View File

@ -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->integer('user_id')->unsigned();
});
}
/** $table->string('id', 100)->primary();
* Reverse the migrations. $table->integer('user_id')->unsigned();
* });
* @return void }
*/
public function down()
{
Schema::drop('access_tokens');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('access_tokens');
}
} }

View File

@ -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->integer('user_id')->unsigned();
$table->integer('sender_id')->unsigned()->nullable();
$table->string('type', 100);
$table->binary('data')->nullable();
$table->dateTime('time');
});
}
/** $table->increments('id');
* Reverse the migrations. $table->integer('user_id')->unsigned();
* $table->integer('sender_id')->unsigned()->nullable();
* @return void $table->string('type', 100);
*/ $table->binary('data')->nullable();
public function down() $table->dateTime('time');
{ });
Schema::drop('activity'); }
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('activity');
}
} }

View File

@ -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->binary('value')->nullable();
});
}
/** $table->string('key', 100)->primary();
* Reverse the migrations. $table->binary('value')->nullable();
* });
* @return void }
*/
public function down()
{
Schema::drop('config');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('config');
}
} }

View File

@ -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->string('title', 200);
$table->integer('comments_count')->unsigned()->default(0);
$table->integer('number_index')->unsigned()->default(0);
$table->dateTime('start_time'); $table->increments('id');
$table->integer('start_user_id')->unsigned()->nullable(); $table->string('title', 200);
$table->integer('start_post_id')->unsigned()->nullable(); $table->integer('comments_count')->unsigned()->default(0);
$table->integer('number_index')->unsigned()->default(0);
$table->dateTime('last_time')->nullable(); $table->dateTime('start_time');
$table->integer('last_user_id')->unsigned()->nullable(); $table->integer('start_user_id')->unsigned()->nullable();
$table->integer('last_post_id')->unsigned()->nullable(); $table->integer('start_post_id')->unsigned()->nullable();
$table->integer('last_post_number')->unsigned()->nullable();
});
}
/** $table->dateTime('last_time')->nullable();
* Reverse the migrations. $table->integer('last_user_id')->unsigned()->nullable();
* $table->integer('last_post_id')->unsigned()->nullable();
* @return void $table->integer('last_post_number')->unsigned()->nullable();
*/ });
public function down() }
{
Schema::drop('discussions');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('discussions');
}
} }

View File

@ -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');
}
} }

View File

@ -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->string('permission', 100);
$table->primary(['group_id', 'permission']);
});
}
/** $table->integer('group_id')->unsigned();
* Reverse the migrations. $table->string('permission', 100);
* $table->primary(['group_id', 'permission']);
* @return void });
*/ }
public function down()
{
Schema::drop('permissions');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permissions');
}
} }

View File

@ -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->integer('discussion_id')->unsigned();
$table->integer('number')->unsigned()->nullable();
$table->dateTime('time'); $table->increments('id');
$table->integer('user_id')->unsigned()->nullable(); $table->integer('discussion_id')->unsigned();
$table->string('type', 100)->nullable(); $table->integer('number')->unsigned()->nullable();
$table->text('content')->nullable();
$table->text('content_html')->nullable();
$table->dateTime('edit_time')->nullable(); $table->dateTime('time');
$table->integer('edit_user_id')->unsigned()->nullable(); $table->integer('user_id')->unsigned()->nullable();
$table->dateTime('hide_time')->nullable(); $table->string('type', 100)->nullable();
$table->integer('hide_user_id')->unsigned()->nullable(); $table->text('content')->nullable();
}); $table->text('content_html')->nullable();
// add fulltext index to content (and title?) $table->dateTime('edit_time')->nullable();
// add unique index on [discussion_id, number] !!! $table->integer('edit_user_id')->unsigned()->nullable();
} $table->dateTime('hide_time')->nullable();
$table->integer('hide_user_id')->unsigned()->nullable();
});
/** // add fulltext index to content (and title?)
* Reverse the migrations. // add unique index on [discussion_id, number] !!!
* }
* @return void
*/
public function down()
{
Schema::drop('posts');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('posts');
}
} }

View File

@ -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('discussion_id')->unsigned();
$table->dateTime('read_time')->nullable();
$table->integer('read_number')->unsigned()->nullable();
$table->primary(['user_id', 'discussion_id']);
});
}
/** $table->integer('user_id')->unsigned();
* Reverse the migrations. $table->integer('discussion_id')->unsigned();
* $table->dateTime('read_time')->nullable();
* @return void $table->integer('read_number')->unsigned()->nullable();
*/ $table->primary(['user_id', 'discussion_id']);
public function down() });
{ }
Schema::drop('users_discussions');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_discussions');
}
} }

View File

@ -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('group_id')->unsigned();
$table->primary(['user_id', 'group_id']);
});
}
/** $table->integer('user_id')->unsigned();
* Reverse the migrations. $table->integer('group_id')->unsigned();
* $table->primary(['user_id', 'group_id']);
* @return void });
*/ }
public function down()
{
Schema::drop('users_groups');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_groups');
}
} }

View File

@ -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');
} }
} }