2024_03_26_201122_create_files_table.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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('files', function (Blueprint $table) {
  13. $table->id();
  14. $table->integer("company_id")->index();
  15. $table->string("pathname", 100);
  16. $table->string("title");
  17. $table->string("extension", 30);
  18. $table->integer("size")->default(0);
  19. $table->string("object_type", 30)->nullable();
  20. $table->integer("object_id")->nullable();
  21. $table->integer("created_by")->nullable();
  22. $table->smallInteger("version")->default(1);
  23. $table->integer("downloads")->default(0);
  24. $table->softDeletes();
  25. $table->timestamps();
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. */
  31. public function down(): void
  32. {
  33. Schema::dropIfExists('files');
  34. }
  35. };