領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6KB

  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. * @return void
  13. */
  14. public function up()
  15. {
  16. MigrationHelper::createTable('emails', $this->schema());
  17. MigrationHelper::createTable('email_histories', $this->schema());
  18. }
  19. /**
  20. * Reverse the migrations.
  21. *
  22. * @return void
  23. */
  24. public function down()
  25. {
  26. Schema::dropIfExists('emails');
  27. Schema::dropIfExists('email_histories');
  28. }
  29. private function schema()
  30. {
  31. return function (Blueprint $table, MigrationHelper $helper) {
  32. $helper->baseColumn()
  33. ->contractId(true)
  34. ->userId(true)
  35. ->receiptIssuingOrderId(true);
  36. $table->dateTime("confirm_datetime")->comment("確定時刻")->nullable();
  37. $table->dateTime('send_datetime')->comment("送信時刻")->nullable();
  38. $table->string('email')->comment("Email");
  39. $table->string('subject')->comment("件名");
  40. $table->text('content')->comment("本文");
  41. $table->string('type')->comment("Emailタイプ");
  42. $table->boolean('is_failed')->comment("失敗")->nullable();
  43. $helper->index(1, [ColumnName::CONTRACT_ID, ColumnName::USER_ID]);
  44. $helper->index(2, ['email']);
  45. $helper->index(3, ['is_failed']);
  46. };
  47. }
  48. };