2018_04_23_095333_create_actives_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateActivesTable extends Migration
  6. {
  7. protected $table = 'actives';
  8. protected $tb_actsThms = 'actives_themes';
  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->tinyInteger('tid')->comment('对应活动主题id')->unsigned();
  19. $table->string('name', 50)->comment('名称');
  20. $table->integer('user_num')->comment('可报人数')->unsigned()->nullable();
  21. $table->string('address')->comment('地址')->nullable();
  22. $table->text('text')->comment('介绍');
  23. $table->datetime('start_time')->comment('开始时间')->nullable();
  24. $table->datetime('end_time')->comment('结束时间')->nullable();
  25. $table->timestamps();
  26. $table->foreign('tid')->references('id')->on($this->tb_actsThms);
  27. });
  28. DB::statement("ALTER TABLE ".$this->table." comment'活动信息表'");
  29. }
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::dropIfExists($this->table);
  38. }
  39. }