2018_04_16_011918_create_media_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateMediaTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('media', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->bigInteger('status_id')->unsigned()->nullable();
  17. $table->bigInteger('profile_id')->unsigned()->nullable();
  18. $table->bigInteger('user_id')->unsigned()->nullable();
  19. $table->string('media_path');
  20. $table->string('thumbnail_path')->nullable();
  21. $table->string('cdn_url')->nullable();
  22. $table->string('optimized_url')->nullable();
  23. $table->string('thumbnail_url')->nullable();
  24. $table->tinyInteger('order')->unsigned()->default(1);
  25. $table->string('mime')->nullable();
  26. $table->unsignedInteger('size')->nullable();
  27. $table->string('orientation')->nullable();
  28. $table->timestamp('processed_at')->nullable();
  29. $table->unique(['status_id', 'media_path']);
  30. $table->timestamps();
  31. });
  32. }
  33. /**
  34. * Reverse the migrations.
  35. *
  36. * @return void
  37. */
  38. public function down()
  39. {
  40. Schema::dropIfExists('media');
  41. }
  42. }