2014_10_12_000000_create_users_table.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateUsersTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('users', function (Blueprint $table) {
  15. $table->id();
  16. $table->string('name');
  17. $table->string('username')->unique();
  18. $table->unsignedBigInteger('parent_id')->default(1);
  19. $table->boolean('is_superuser')->default(0);
  20. $table->boolean('is_banned')->default(0);
  21. $table->enum('two_factor_status', ['off', 'sms', 'email']);
  22. $table->string('mobile');
  23. $table->string('email');
  24. $table->timestamp('email_verified_at')->nullable();
  25. $table->string('password');
  26. $table->rememberToken();
  27. $table->timestamps();
  28. $table->softDeletes();
  29. $table->foreign('parent_id')
  30. ->references('id')
  31. ->on('users');
  32. });
  33. }
  34. /**
  35. * Reverse the migrations.
  36. *
  37. * @return void
  38. */
  39. public function down()
  40. {
  41. // It's in laratrust_setup_table because has relations..
  42. }
  43. }