2024_05_20_062706_update_group_posts_table.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\DB;
  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::table('group_posts', function (Blueprint $table) {
  14. if (DB::getDriverName() === 'sqlite') {
  15. $table->dropUnique(['status_id']);
  16. }
  17. $table->dropColumn('status_id');
  18. $table->dropColumn('reply_child_id');
  19. $table->dropColumn('in_reply_to_id');
  20. $table->dropColumn('reblog_of_id');
  21. $table->text('caption')->nullable();
  22. $table->string('visibility')->nullable();
  23. $table->boolean('is_nsfw')->default(false);
  24. $table->unsignedInteger('likes_count')->default(0);
  25. $table->text('cw_summary')->nullable();
  26. $table->json('media_ids')->nullable();
  27. $table->boolean('comments_disabled')->default(false);
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. */
  33. public function down(): void
  34. {
  35. Schema::table('group_posts', function (Blueprint $table) {
  36. $table->bigInteger('status_id')->unsigned()->unique()->nullable();
  37. $table->bigInteger('reply_child_id')->unsigned()->nullable();
  38. $table->bigInteger('in_reply_to_id')->unsigned()->nullable();
  39. $table->bigInteger('reblog_of_id')->unsigned()->nullable();
  40. $table->dropColumn('caption');
  41. $table->dropColumn('is_nsfw');
  42. $table->dropColumn('visibility');
  43. $table->dropColumn('likes_count');
  44. $table->dropColumn('cw_summary');
  45. $table->dropColumn('media_ids');
  46. $table->dropColumn('comments_disabled');
  47. });
  48. }
  49. };