2018_08_08_100000_create_telescope_entries_table.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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('telescope_entries', function (Blueprint $table) {
  13. $table->bigIncrements('sequence');
  14. $table->uuid('uuid');
  15. $table->uuid('batch_id');
  16. $table->string('family_hash')->nullable();
  17. $table->boolean('should_display_on_index')->default(true);
  18. $table->string('type', 20);
  19. $table->longText('content');
  20. $table->dateTime('created_at')->nullable();
  21. $table->unique('uuid');
  22. $table->index('batch_id');
  23. $table->index('family_hash');
  24. $table->index('created_at');
  25. $table->index(['type', 'should_display_on_index']);
  26. });
  27. Schema::create('telescope_entries_tags', function (Blueprint $table) {
  28. $table->uuid('entry_uuid');
  29. $table->string('tag');
  30. $table->primary(['entry_uuid', 'tag']);
  31. $table->index('tag');
  32. $table->foreign('entry_uuid')
  33. ->references('uuid')
  34. ->on('telescope_entries')
  35. ->onDelete('cascade');
  36. });
  37. Schema::create('telescope_monitoring', function (Blueprint $table) {
  38. $table->string('tag')->primary();
  39. });
  40. }
  41. /**
  42. * Reverse the migrations.
  43. */
  44. public function down(): void
  45. {
  46. Schema::dropIfExists('telescope_entries_tags');
  47. Schema::dropIfExists('telescope_entries');
  48. Schema::dropIfExists('telescope_monitoring');
  49. }
  50. };