Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 4lun/3f67b5d2ef4df564549a to your computer and use it in GitHub Desktop.
Save 4lun/3f67b5d2ef4df564549a to your computer and use it in GitHub Desktop.
Upgrade to Laravel 5.2: Migration for sessions table
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdditionalSessionColumnsForLaravel52 extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('sessions', function (Blueprint $table) {
$table->integer('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('sessions', function (Blueprint $table) {
$table->dropColumn('user_id');
$table->dropColumn('ip_address');
$table->dropColumn('user_agent');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment