Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

51 řádky
1.7KB

  1. <?php
  2. use App\Util\MigrationHelper;
  3. use Illuminate\Database\Migrations\Migration;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. */
  11. public function up(): void
  12. {
  13. Schema::create('users', function (Blueprint $table) {
  14. $helper = new MigrationHelper($table);
  15. $helper->baseColumn();
  16. $table->string('email')->unique()->comment('Email');
  17. $table->string('password')->nullable()->comment('ログインパスワード');
  18. $table->string('kintone_id')->nullable()->comment('KintoneID');
  19. $table->string('kintone_customer_code')->nullable()->comment('顧客コード');
  20. $helper->index(1, ['email']);
  21. $helper->index(2, ['kintone_id']);
  22. $helper->index(3, ['kintone_customer_code']);
  23. });
  24. Schema::create('user_histories', function (Blueprint $table) {
  25. $helper = new MigrationHelper($table, true);
  26. $helper->baseColumn();
  27. $table->string('email')->comment('Email');
  28. $table->string('password')->nullable()->comment('ログインパスワード');
  29. $table->string('kintone_id')->nullable()->comment('KintoneID');
  30. $table->string('kintone_customer_code')->nullable()->comment('顧客コード');
  31. $helper->index(1, ['email']);
  32. $helper->index(2, ['kintone_id']);
  33. $helper->index(3, ['kintone_customer_code']);
  34. });
  35. }
  36. /**
  37. * Reverse the migrations.
  38. */
  39. public function down(): void
  40. {
  41. Schema::dropIfExists('users');
  42. Schema::dropIfExists('user_histories');
  43. }
  44. };