0001_01_01_000000_create_sessions_table.php 789 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('sessions', function (Blueprint $table) {
  13. $table->string('id')->primary();
  14. $table->foreignId('user_id')->nullable()->index();
  15. $table->string('ip_address', 45)->nullable();
  16. $table->text('user_agent')->nullable();
  17. $table->longText('payload');
  18. $table->integer('last_activity')->index();
  19. });
  20. }
  21. /**
  22. * Reverse the migrations.
  23. */
  24. public function down(): void
  25. {
  26. Schema::dropIfExists('sessions');
  27. }
  28. };