2024_05_20_073054_create_group_likes_table.php 963 B

123456789101112131415161718192021222324252627282930313233
  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('group_likes', function (Blueprint $table) {
  13. $table->bigIncrements('id');
  14. $table->unsignedBigInteger('group_id');
  15. $table->unsignedBigInteger('profile_id')->index();
  16. $table->unsignedBigInteger('status_id')->nullable();
  17. $table->unsignedBigInteger('comment_id')->nullable();
  18. $table->boolean('local')->default(true);
  19. $table->unique(['group_id', 'profile_id', 'status_id', 'comment_id'], 'group_likes_gpsc_unique');
  20. $table->timestamps();
  21. });
  22. }
  23. /**
  24. * Reverse the migrations.
  25. */
  26. public function down(): void
  27. {
  28. Schema::dropIfExists('group_likes');
  29. }
  30. };