2017_04_02_113151_create_account_logs_table.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. /**
  6. * Migration auto-generated by Sequel Pro Laravel Export
  7. * @see https://github.com/cviebrock/sequel-pro-laravel-export
  8. */
  9. class CreateAccountLogsTable extends Migration
  10. {
  11. /**
  12. * Run the migrations.
  13. *
  14. * @return void
  15. */
  16. public function up()
  17. {
  18. Schema::create('account_logs', function (Blueprint $table) {
  19. $table->increments('id');
  20. $table->unsignedInteger('from_id')->comment('来源对象id');
  21. $table->string('from_name', 100)->nullable()->comment('来源对象名称');
  22. $table->string('op', 20)->comment('操作,charge:冲值,support:消耗,withdraw:提现');
  23. $table->string('from_type', 20)->comment('操作类型,1、余额,2、梦想币,3、现金');
  24. $table->unsignedInteger('from_amount')->comment('操作金额from');
  25. $table->string('to_type', 20)->comment('操作类型,1、余额,2、梦想币,3、现金');
  26. $table->unsignedInteger('to_id')->comment('目标对象id');
  27. $table->string('to_name', 100)->nullable()->comment('来源目标对象名称');
  28. $table->unsignedInteger('to_amount')->comment('操作金额to');
  29. $table->nullableTimestamps();
  30. $table->index(['from_id'], 'idx_from');
  31. $table->index(['to_id'], 'idx_to');
  32. $table->index('from_type', 'idx_from_type');
  33. $table->index('to_type', 'idx_to_type');
  34. $table->index('created_at', 'idx_created_at');
  35. });
  36. }
  37. /**
  38. * Reverse the migrations.
  39. *
  40. * @return void
  41. */
  42. public function down()
  43. {
  44. Schema::dropIfExists('account_logs');
  45. }
  46. }