領収証発行サービス
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

48 行
1.2KB

  1. <?php
  2. use App\Models\ColumnName;
  3. use App\Util\MigrationHelper;
  4. use Illuminate\Database\Migrations\Migration;
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Support\Facades\Schema;
  7. return new class extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. */
  12. public function up(): void
  13. {
  14. MigrationHelper::createTable('users', $this->schema());
  15. MigrationHelper::createTable('user_histories', $this->schema());
  16. }
  17. /**
  18. * Reverse the migrations.
  19. */
  20. public function down(): void
  21. {
  22. Schema::dropIfExists('users');
  23. Schema::dropIfExists('user_histories');
  24. }
  25. private function schema()
  26. {
  27. return function (Blueprint $table, MigrationHelper $helper) {
  28. $helper->baseColumn()
  29. ->contractId();
  30. $table->string('email')->comment("Email")->nullable();
  31. $table->string('password')->comment("ログインパスワード")->nullable();
  32. $table->unsignedTinyInteger("role")->comment("認可")->nullable();
  33. $table->string('name')->comment("氏名")->nullable();
  34. $helper->index(1, [ColumnName::CONTRACT_ID]);
  35. $helper->index(2, ['email']);
  36. };
  37. }
  38. };