0001_01_01_000000_create_users_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * Run the migrations.
  8. */
  9. public function up(): void
  10. {
  11. Schema::create('users', function (Blueprint $table) {
  12. $table->id();
  13. $table->string('name');
  14. $table->string('email')->unique();
  15. $table->timestamp('email_verified_at')->nullable();
  16. $table->string('password');
  17. $table->rememberToken();
  18. $table->timestamps();
  19. });
  20. Schema::create('password_reset_tokens', function (Blueprint $table) {
  21. $table->string('email')->primary();
  22. $table->string('token');
  23. $table->timestamp('created_at')->nullable();
  24. });
  25. Schema::create('sessions', function (Blueprint $table) {
  26. $table->string('id')->primary();
  27. $table->foreignId('user_id')->nullable()->index();
  28. $table->string('ip_address', 45)->nullable();
  29. $table->text('user_agent')->nullable();
  30. $table->longText('payload');
  31. $table->integer('last_activity')->index();
  32. });
  33. }
  34. /**
  35. * Reverse the migrations.
  36. */
  37. public function down(): void
  38. {
  39. Schema::dropIfExists('users');
  40. Schema::dropIfExists('password_reset_tokens');
  41. Schema::dropIfExists('sessions');
  42. }
  43. };