0001_01_01_000000_create_users_table.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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')->nullable();
  15. $table->string('email')->unique();
  16. $table->string('photo')->nullable();
  17. $table->string('password')->nullable();
  18. $table->string('phone')->nullable();
  19. $table->string('country')->nullable();
  20. $table->string('address')->nullable();
  21. $table->string('state')->nullable();
  22. $table->string('city')->nullable();
  23. $table->string('zip')->nullable();
  24. $table->string('token')->nullable();
  25. $table->string('status')->default(0)->comment('0=pending, 1=active, 2=suspended');
  26. $table->timestamps();
  27. });
  28. Schema::create('password_reset_tokens', function (Blueprint $table) {
  29. $table->string('email')->primary();
  30. $table->string('token');
  31. $table->timestamp('created_at')->nullable();
  32. });
  33. Schema::create('sessions', function (Blueprint $table) {
  34. $table->string('id')->primary();
  35. $table->foreignId('user_id')->nullable()->index();
  36. $table->string('ip_address', 45)->nullable();
  37. $table->text('user_agent')->nullable();
  38. $table->longText('payload');
  39. $table->integer('last_activity')->index();
  40. });
  41. }
  42. /**
  43. * Reverse the migrations.
  44. */
  45. public function down(): void
  46. {
  47. Schema::dropIfExists('users');
  48. Schema::dropIfExists('password_reset_tokens');
  49. Schema::dropIfExists('sessions');
  50. }
  51. };