2018_09_04_154401_create_admins_roles_table.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateAdminsRolesTable extends Migration
  6. {
  7. protected $table = 'admins_roles';
  8. protected $tb_menusAd = 'menus_ad';
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Schema::create($this->table, function (Blueprint $table) {
  17. $table->increments('id')->comment('唯一标识')->unsigned();
  18. $table->string('name', 25)->comment('名称')->unique();
  19. $table->string('description')->comment('描述');
  20. $table->string('menus_id', 50)->comment('可操作菜单id值');
  21. $table->timestamps();
  22. $table->foreign('menus_id')->references('id')->on($this->tb_menusAd);
  23. });
  24. DB::statement("ALTER TABLE ".$this->table." comment'管理员角色信息表'");
  25. }
  26. /**
  27. * Reverse the migrations.
  28. *
  29. * @return void
  30. */
  31. public function down()
  32. {
  33. Schema::dropIfExists($this->table);
  34. }
  35. }