2020_08_21_145711_create_node_label_table.php 694 B

123456789101112131415161718192021222324252627282930
  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. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up() {
  12. Schema::create('node_label', function(Blueprint $table) {
  13. $table->increments('id');
  14. $table->unsignedInteger('node_id')->default(0)->comment('节点ID');
  15. $table->unsignedInteger('label_id')->default(0)->comment('标签ID');
  16. $table->index(['node_id', 'label_id'], 'idx_node_label');
  17. });
  18. }
  19. /**
  20. * Reverse the migrations.
  21. *
  22. * @return void
  23. */
  24. public function down() {
  25. Schema::dropIfExists('node_label');
  26. }
  27. }