2020_08_21_145711_create_node_label_table.php 799 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateNodeLabelTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('node_label', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->unsignedInteger('node_id')->default(0)->comment('节点ID');
  17. $table->unsignedInteger('label_id')->default(0)->comment('标签ID');
  18. $table->index(['node_id', 'label_id'], 'idx_node_label');
  19. });
  20. }
  21. /**
  22. * Reverse the migrations.
  23. *
  24. * @return void
  25. */
  26. public function down()
  27. {
  28. Schema::dropIfExists('node_label');
  29. }
  30. }