0001_01_01_000000_create_users_table.php 1.4 KB

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