Skip to content

Commit 3babe8f

Browse files
committed
Cleanup Migrations
1 parent 125b224 commit 3babe8f

File tree

37 files changed

+821
-844
lines changed

37 files changed

+821
-844
lines changed
Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
45

5-
class CreateUsersTable extends Migration {
6+
class CreateUsersTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('users', function(Blueprint $table) {
16+
$table->increments('id');
17+
$table->string('github_id');
18+
$table->string('github_url');
19+
$table->string('email')->nullable();
20+
$table->string('name');
621

7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
12-
public function up()
13-
{
14-
//
15-
Schema::table('users', function($t) {
16-
$t->create();
22+
$table->timestamps();
23+
});
24+
}
1725

18-
$t->increments('id');
19-
$t->string('github_id');
20-
$t->string('github_url');
21-
$t->string('email')->nullable();
22-
$t->string('name');
23-
24-
$t->timestamps();
25-
});
26-
}
27-
28-
/**
29-
* Reverse the migrations.
30-
*
31-
* @return void
32-
*/
33-
public function down()
34-
{
35-
//
36-
Schema::drop('users');
37-
}
38-
39-
}
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
Schema::drop('users');
34+
}
35+
}

database/migrations/2013_09_17_160916_create_roles_table.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
45

5-
class CreateRolesTable extends Migration {
6-
7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
6+
class CreateRolesTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
1213
public function up()
1314
{
14-
Schema::create('roles', function($t) {
15-
$t->increments('id');
16-
$t->string('name');
17-
$t->string('description');
18-
$t->timestamps();
15+
Schema::create('roles', function(Blueprint $table) {
16+
$table->increments('id');
17+
$table->string('name');
18+
$table->string('description');
19+
$table->timestamps();
1920
});
2021
}
2122

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
45

5-
class CreateRoleUserTable extends Migration {
6-
7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
12-
public function up()
13-
{
14-
Schema::create('role_user', function($t) {
15-
$t->increments('id');
16-
$t->integer('user_id');
17-
$t->integer('role_id');
18-
$t->index('user_id');
6+
class CreateRoleUserTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('role_user', function(Blueprint $table) {
16+
$table->increments('id');
17+
$table->integer('user_id');
18+
$table->integer('role_id');
19+
$table->index('user_id');
1920
});
20-
}
21+
}
2122

22-
/**
23-
* Reverse the migrations.
24-
*
25-
* @return void
26-
*/
27-
public function down()
28-
{
23+
/**
24+
* Reverse the migrations.
25+
*
26+
* @return void
27+
*/
28+
public function down()
29+
{
2930
Schema::drop('role_user');
30-
}
31+
}
3132
}
Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
45

5-
class AddIsBannedFieldToUsers extends Migration {
6+
class AddIsBannedFieldToUsers extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('users', function(Blueprint $table) {
16+
$table->integer('is_banned')->default(0);
17+
});
18+
}
619

7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
12-
public function up()
13-
{
14-
//
15-
Schema::table('users', function($t) {
16-
$t->integer('is_banned')->defaults(0);
17-
});
18-
}
19-
20-
/**
21-
* Reverse the migrations.
22-
*
23-
* @return void
24-
*/
25-
public function down()
26-
{
27-
//
28-
Schema::table('users', function($t) {
29-
$t->dropColumn('is_banned');
30-
});
31-
}
32-
33-
}
20+
/**
21+
* Reverse the migrations.
22+
*
23+
* @return void
24+
*/
25+
public function down()
26+
{
27+
Schema::table('users', function(Blueprint $table) {
28+
$table->dropColumn('is_banned');
29+
});
30+
}
31+
}
Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
45

5-
class CreatePastesTable extends Migration {
6+
class CreatePastesTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('pastes', function(Blueprint $table) {
16+
$table->increments('id');
17+
$table->integer('author_id')->nullable();
18+
$table->integer('parent_id')->nullable();
19+
$table->text('description')->nullable();
20+
$table->text('code');
21+
$table->integer('comment_count');
22+
$table->integer('child_count');
623

7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
12-
public function up()
13-
{
14-
Schema::table('pastes', function($t) {
15-
$t->create();
24+
$table->timestamps();
25+
});
26+
}
1627

17-
$t->increments('id');
18-
$t->integer('author_id')->nullable();
19-
$t->integer('parent_id')->nullable();
20-
$t->text('description')->nullable();
21-
$t->text('code');
22-
$t->integer('comment_count');
23-
$t->integer('child_count');
24-
25-
$t->timestamps();
26-
});
27-
}
28-
29-
/**
30-
* Reverse the migrations.
31-
*
32-
* @return void
33-
*/
34-
public function down()
35-
{
36-
Schema::drop('pastes');
37-
}
38-
39-
}
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
Schema::drop('pastes');
36+
}
37+
}
Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
11
<?php
22

33
use Illuminate\Database\Migrations\Migration;
4-
5-
class CreateCommentsTable extends Migration {
6-
7-
/**
8-
* Run the migrations.
9-
*
10-
* @return void
11-
*/
12-
public function up()
13-
{
14-
Schema::table('comments', function($t) {
15-
$t->create();
16-
17-
$t->increments('id');
18-
19-
$t->string('title')->nullable();
20-
$t->text('body');
21-
22-
$t->string('owner_type');
23-
$t->integer('owner_id');
24-
25-
$t->integer('author_id');
26-
$t->integer('parent_id')->nullable();
27-
28-
$t->integer('child_count')->defaults(0);
29-
$t->integer('most_recent_child_id')->nullable();
30-
31-
$t->timestamps();
32-
});
33-
}
34-
35-
/**
36-
* Reverse the migrations.
37-
*
38-
* @return void
39-
*/
40-
public function down()
41-
{
42-
Schema::drop('comments');
43-
}
44-
45-
}
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateCommentsTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('comments', function(Blueprint $table) {
16+
$table->increments('id');
17+
18+
$table->string('title')->nullable();
19+
$table->text('body');
20+
21+
$table->string('owner_type');
22+
$table->integer('owner_id');
23+
24+
$table->integer('author_id');
25+
$table->integer('parent_id')->nullable();
26+
27+
$table->integer('child_count')->default(0);
28+
$table->integer('most_recent_child_id')->nullable();
29+
30+
$table->timestamps();
31+
});
32+
}
33+
34+
/**
35+
* Reverse the migrations.
36+
*
37+
* @return void
38+
*/
39+
public function down()
40+
{
41+
Schema::drop('comments');
42+
}
43+
}

0 commit comments

Comments
 (0)