Update the sessions table (#1030)

* Update the sessions table

* Add index on user_id
This commit is contained in:
Nabeel S 2021-02-11 08:50:49 -05:00 committed by GitHub
parent be9b698f14
commit 447d02bd4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,20 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Bring the sessions table in line with the latest
*/
class UpdateSessionsTable extends Migration
{
public function up()
{
Schema::table('sessions', function (Blueprint $table) {
$table->string('id')->change()->primary();
$table->index('user_id');
$table->index('last_activity');
});
}
}

View File

@ -107,7 +107,7 @@ return [
// Overrides config/session.php
'session' => [
'default' => 'file',
'default' => 'database',
'lifetime' => 60 * 24, # 24 hours
],
];