Where possible, merge migrations to prevent clutter
MODIFY
database/migrations/2014_10_12_000000_create_users_table.php
database/migrations/2014_10_12_000000_create_users_table.php
@@ -13,9 +13,11 @@ class CreateUsersTable extends Migration {
$table->string('name');
$table->string('email')->unique();
$table->string('password');
+ $table->string('verification_token', 100)->nullable();
$table->rememberToken();
- $table->string('language');
+ $table->string('language')->default('en');
$table->string('theme')->default('light');
+ $table->boolean('weekly_report')->default(true);
$table->timestamps();
});
}

MODIFY
database/migrations/2017_07_19_000000_create_tags_table.php
database/migrations/2017_07_19_000000_create_tags_table.php
@@ -10,6 +10,7 @@ class CreateTagsTable extends Migration {
$table->increments('id');
$table->unsignedInteger('space_id');
$table->string('name');
+ $table->char('color', 6);
$table->timestamps();
$table->softDeletes();
});

DELETE
database/migrations/2018_10_06_080643_set_default_language_in_users_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class SetDefaultLanguageInUsersTable extends Migration {
- public function up() {
- Schema::table('users', function (Blueprint $table) {
- $table->string('language')->default('en')->change();
- });
- }
-}

DELETE
database/migrations/2018_10_09_165132_add_weekly_report_column_to_users_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddWeeklyReportColumnToUsersTable extends Migration {
- public function up() {
- Schema::table('users', function (Blueprint $table) {
- $table->boolean('weekly_report')->default(true)->after('theme');
- });
- }
-
- public function down() {
- Schema::table('users', function (Blueprint $table) {
- $table->dropColumn('weekly_report');
- });
- }
-}

DELETE
database/migrations/2018_10_16_112030_add_verification_token_column_to_users_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddVerificationTokenColumnToUsersTable extends Migration {
- public function up() {
- Schema::table('users', function (Blueprint $table) {
- $table->string('verification_token', 100)->nullable()->after('password');
- });
- }
-
- public function down() {
- Schema::table('users', function (Blueprint $table) {
- $table->dropColumn('verification_token');
- });
- }
-}

MODIFY
database/migrations/2018_11_06_201307_create_ideas_table.php
database/migrations/2018_11_06_201307_create_ideas_table.php
@@ -9,6 +9,7 @@ class CreateIdeasTable extends Migration {
Schema::create('ideas', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
+ $table->string('type');
$table->text('body');
$table->timestamps();

RENAME
database/migrations/2018_12_17_174821_create_notifications_table.php
database/migrations/2018_12_17_174821_create_activities_table.php
@@ -4,9 +4,9 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreateNotificationsTable extends Migration {
+class CreateActivitiesTable extends Migration {
public function up() {
- Schema::create('notifications', function (Blueprint $table) {
+ Schema::create('activities', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('space_id');
$table->unsignedInteger('user_id')->nullable();
@@ -21,11 +21,11 @@ class CreateNotificationsTable extends Migration {
}
public function down() {
- Schema::table('notifications', function ($table) {
- $table->dropForeign('notifications_space_id_foreign');
- $table->dropForeign('notifications_user_id_foreign');
+ Schema::table('activities', function ($table) {
+ $table->dropForeign('activities_space_id_foreign');
+ $table->dropForeign('activities_user_id_foreign');
});
- Schema::dropIfExists('notifications');
+ Schema::dropIfExists('activities');
}
}

DELETE
database/migrations/2018_12_21_222756_add_color_to_tags_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddColorToTagsTable extends Migration {
- public function up() {
- Schema::table('tags', function (Blueprint $table) {
- $table->char('color', 6)->after('name');
- });
- }
-
- public function down() {
- Schema::table('tags', function (Blueprint $table) {
- $table->dropColumn('color');
- });
- }
-}

DELETE
database/migrations/2019_01_08_184758_add_type_column_to_ideas_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddTypeColumnToIdeasTable extends Migration {
- public function up() {
- Schema::table('ideas', function (Blueprint $table) {
- $table->string('type')->after('user_id');
- });
- }
-
- public function down() {
- Schema::table('ideas', function (Blueprint $table) {
- $table->dropColumn($table);
- });
- }
-}

DELETE
database/migrations/2019_01_08_203427_rename_notifications_table.php
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class RenameNotificationsTable extends Migration {
- public function up() {
- Schema::rename('notifications', 'activities');
- }
-
- public function down() {
- Schema::rename('activities', 'notifications');
- }
-}

Where possible, merge migrations to prevent clutter