2023_04_26_024500_create_user_table.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('user', function (Blueprint $table) {
  14. $table->id();
  15. $table->string("name")->default("")->comment("昵称");
  16. $table->string("phone")->default("");
  17. $table->string("password")->default("");
  18. $table->string("email")->default("");
  19. $table->unsignedTinyInteger("status")->default(0)->comment("0 禁用 1启用");
  20. $table->unsignedInteger("group_id")->default(0);
  21. $table->string("openid")->default("")->comment("微信openid");
  22. $table->string("extra", 2000)->default("")->comment("糊屎字段");
  23. $table->timestamps();
  24. $table->index("openid");
  25. $table->index("email");
  26. });
  27. Schema::create('admin_group', function (Blueprint $table) {
  28. $table->id();
  29. $table->string("name")->default("");
  30. $table->timestamps();
  31. });
  32. Schema::create('admin_permission', function (Blueprint $table) {
  33. $table->id();
  34. $table->string("name")->default("");
  35. $table->string("code")->default("");
  36. $table->timestamps();
  37. });
  38. }
  39. /**
  40. * Reverse the migrations.
  41. *
  42. * @return void
  43. */
  44. public function down()
  45. {
  46. Schema::dropIfExists('user');
  47. Schema::dropIfExists('admin_group');
  48. Schema::dropIfExists('admin_permission');
  49. }
  50. };