wire postgres session repo, migrations, seed, and dev serve
This commit is contained in:
parent
02effe761a
commit
89b63cb9e9
8 changed files with 235 additions and 2 deletions
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use App\Database\Migration;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class CreateSessionsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Capsule::schema()->create('sessions', function ($table) {
|
||||
$table->string('token')->primary();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->foreign('user_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->cascadeOnDelete();
|
||||
$table->dateTime('expires_at');
|
||||
$table->dateTime('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Capsule::schema()->dropIfExists('sessions');
|
||||
}
|
||||
}
|
||||
|
||||
return CreateSessionsTable::class;
|
||||
Loading…
Add table
Add a link
Reference in a new issue