2018_04_01_153109_create_admins_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateAdminsTable extends Migration
  6. {
  7. protected $table = TABLE_ADMINS;
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create($this->table, function (Blueprint $table) {
  16. $table->increments('id')->comment('唯一标识')->unsigned();
  17. $table->string('name', 25)->comment('管理员账号')->unique();
  18. $table->integer('rid')->comment('对应角色id值')->unique();
  19. $table->string('password')->comment('密码');
  20. $table->dateTime('last_time')->comment('最后一次登录时间')->nullable();
  21. $table->rememberToken();
  22. $table->timestamps();
  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. }