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\Migrations\Migration;
class CreateAccessTokensTable extends Migration {
class CreateAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('access_tokens', function(Blueprint $table)
{
$table->string('id', 100)->primary();
$table->integer('user_id')->unsigned();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('access_tokens', function (Blueprint $table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('access_tokens');
}
$table->string('id', 100)->primary();
$table->integer('user_id')->unsigned();
});
}
/**
* 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\Migrations\Migration;
class CreateActivityTable extends Migration {
class CreateActivityTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('activity', function (Blueprint $table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('activity');
}
$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');
});
}
/**
* 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\Migrations\Migration;
class CreateConfigTable extends Migration {
class CreateConfigTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('config', function(Blueprint $table)
{
$table->string('key', 100)->primary();
$table->binary('value')->nullable();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('config', function (Blueprint $table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('config');
}
$table->string('key', 100)->primary();
$table->binary('value')->nullable();
});
}
/**
* 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\Migrations\Migration;
class CreateDiscussionsTable extends Migration {
class CreateDiscussionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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);
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('discussions', function (Blueprint $table) {
$table->dateTime('start_time');
$table->integer('start_user_id')->unsigned()->nullable();
$table->integer('start_post_id')->unsigned()->nullable();
$table->increments('id');
$table->string('title', 200);
$table->integer('comments_count')->unsigned()->default(0);
$table->integer('number_index')->unsigned()->default(0);
$table->dateTime('last_time')->nullable();
$table->integer('last_user_id')->unsigned()->nullable();
$table->integer('last_post_id')->unsigned()->nullable();
$table->integer('last_post_number')->unsigned()->nullable();
});
}
$table->dateTime('start_time');
$table->integer('start_user_id')->unsigned()->nullable();
$table->integer('start_post_id')->unsigned()->nullable();
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('discussions');
}
$table->dateTime('last_time')->nullable();
$table->integer('last_user_id')->unsigned()->nullable();
$table->integer('last_post_id')->unsigned()->nullable();
$table->integer('last_post_number')->unsigned()->nullable();
});
}
/**
* 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\Migrations\Migration;
class CreateNotificationsTable extends Migration {
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('sender_id')->unsigned()->nullable();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('sender_id')->unsigned()->nullable();
$table->string('type', 100);
$table->string('subject_type', 200)->nullable();
$table->integer('subject_id')->unsigned()->nullable();
$table->binary('data')->nullable();
$table->dateTime('time');
$table->boolean('is_read')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications');
}
$table->integer('subject_id')->unsigned()->nullable();
$table->binary('data')->nullable();
$table->dateTime('time');
$table->boolean('is_read')->default(0);
});
}
/**
* 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\Migrations\Migration;
class CreatePermissionsTable extends Migration {
class CreatePermissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function($table)
{
$table->integer('group_id')->unsigned();
$table->string('permission', 100);
$table->primary(['group_id', 'permission']);
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function ($table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permissions');
}
$table->integer('group_id')->unsigned();
$table->string('permission', 100);
$table->primary(['group_id', 'permission']);
});
}
/**
* 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\Migrations\Migration;
class CreatePostsTable extends Migration {
class CreatePostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('posts', function(Blueprint $table)
{
$table->increments('id');
$table->integer('discussion_id')->unsigned();
$table->integer('number')->unsigned()->nullable();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->dateTime('time');
$table->integer('user_id')->unsigned()->nullable();
$table->string('type', 100)->nullable();
$table->text('content')->nullable();
$table->text('content_html')->nullable();
$table->increments('id');
$table->integer('discussion_id')->unsigned();
$table->integer('number')->unsigned()->nullable();
$table->dateTime('edit_time')->nullable();
$table->integer('edit_user_id')->unsigned()->nullable();
$table->dateTime('hide_time')->nullable();
$table->integer('hide_user_id')->unsigned()->nullable();
});
$table->dateTime('time');
$table->integer('user_id')->unsigned()->nullable();
$table->string('type', 100)->nullable();
$table->text('content')->nullable();
$table->text('content_html')->nullable();
// add fulltext index to content (and title?)
// add unique index on [discussion_id, number] !!!
}
$table->dateTime('edit_time')->nullable();
$table->integer('edit_user_id')->unsigned()->nullable();
$table->dateTime('hide_time')->nullable();
$table->integer('hide_user_id')->unsigned()->nullable();
});
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('posts');
}
// add fulltext index to content (and title?)
// add unique index on [discussion_id, number] !!!
}
/**
* 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\Migrations\Migration;
class CreateUsersDiscussionsTable extends Migration {
class CreateUsersDiscussionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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']);
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_discussions', function (Blueprint $table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_discussions');
}
$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']);
});
}
/**
* 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\Migrations\Migration;
class CreateUsersGroupsTable extends Migration {
class CreateUsersGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_groups', function(Blueprint $table)
{
$table->integer('user_id')->unsigned();
$table->integer('group_id')->unsigned();
$table->primary(['user_id', 'group_id']);
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_groups', function (Blueprint $table) {
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users_groups');
}
$table->integer('user_id')->unsigned();
$table->integer('group_id')->unsigned();
$table->primary(['user_id', 'group_id']);
});
}
/**
* 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\Migrations\Migration;
class CreateUsersTable extends Migration {
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
@ -12,8 +13,8 @@ class CreateUsersTable extends Migration {
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username', 100)->unique();
$table->string('email', 150)->unique();
@ -43,5 +44,4 @@ class CreateUsersTable extends Migration {
{
Schema::drop('users');
}
}