2017_05_30_203523_create_base_attachments_table.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. /**
  6. * Migration auto-generated by Sequel Pro Laravel Export
  7. * @see https://github.com/cviebrock/sequel-pro-laravel-export
  8. */
  9. class CreateBaseAttachmentsTable extends Migration
  10. {
  11. /**
  12. * Run the migrations.
  13. *
  14. * @return void
  15. */
  16. public function up()
  17. {
  18. Schema::create('base_attachments', function (Blueprint $table) {
  19. $table->increments('id');
  20. $table->string('name', 255)->comment('附件名称');
  21. $table->string('md5', 50)->comment('md5码');
  22. $table->string('path', 1024)->comment('附件路径');
  23. $table->string('url', 1024)->comment('附件url');
  24. $table->string('class', 255)->default('未分类')->comment('分类');
  25. $table->unsignedBigInteger('size')->nullable();
  26. $table->string('file_type', 100)->nullable();
  27. $table->unsignedBigInteger('download')->default(0);
  28. $table->string('klass', 50)->nullable()->comment('关联模型');
  29. $table->unsignedInteger('objid')->nullable()->comment('关联id');
  30. $table->timestamps();
  31. $table->softDeletes();
  32. $table->index('md5', 'idx_md5');
  33. $table->index(['klass', 'objid'], 'idx_klass_objid');
  34. });
  35. }
  36. /**
  37. * Reverse the migrations.
  38. *
  39. * @return void
  40. */
  41. public function down()
  42. {
  43. Schema::dropIfExists('base_attachments');
  44. }
  45. }