2019_07_14_171845_create_configs_table.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateConfigsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('configs', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->unsignedInteger('category_id')->index();
  17. $table->string('type')->default(\App\Models\Config::TYPE_INPUT);
  18. $table->string('name', 50);
  19. $table->string('slug', 50)->index();
  20. $table->string('desc')->nullable();
  21. $table->string('options')->nullable()->comment('填写配置时的选项,比如单选、多选下拉的选项');
  22. $table->string('value', 5000)->nullable();
  23. $table->string('validation_rules', 255)->nullable()->comment('验证规则');
  24. $table->timestamps();
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::dropIfExists('configs');
  35. }
  36. }