2015_11_25_124050_create_credits_table.php 1002 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateCreditsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('credits', function (Blueprint $table) {
  15. $table->increments('id')->unsigned();
  16. $table->integer('user_id')->unsigned()->index();
  17. $table->char('action',16);
  18. $table->integer('source_id')->unsigned()->index(); //问题、回答或文字ID
  19. $table->string('source_subject',128)->nullable(); //问题标题或文字标题等
  20. $table->integer('coins')->default(0);
  21. $table->integer('credits')->default(0);
  22. $table->timestamp('created_at');
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::drop('credits');
  33. }
  34. }