2025_09_18_093938_create_badgeables_table.php 828B

1234567891011121314151617181920212223242526272829303132
  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. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('badgeables', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('badge_id')->constrained()->cascadeOnDelete();
  15. $table->morphs('badgeable');
  16. $table->date("award_date")->nullable()->comment("取得標章時刻");
  17. $table->tinyInteger("award_type")->comment("1. 永續目標 2.取得標章");
  18. $table->timestamps();
  19. });
  20. }
  21. /**
  22. * Reverse the migrations.
  23. */
  24. public function down(): void
  25. {
  26. Schema::dropIfExists('badgeables');
  27. }
  28. };