2020_03_23_214935_create_pay_tables.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * This file is part of ibrand/pay.
  4. *
  5. * (c) 果酱社区 <https://guojiang.club>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Illuminate\Support\Facades\Schema;
  11. use Illuminate\Database\Schema\Blueprint;
  12. use Illuminate\Database\Migrations\Migration;
  13. class CreatePayTables extends Migration
  14. {
  15. /**
  16. * Run the migrations.
  17. *
  18. * @return void
  19. */
  20. public function up()
  21. {
  22. if (!Schema::hasTable('ibrand_pay_charge')) {
  23. Schema::create('ibrand_pay_charge', function (Blueprint $table) {
  24. $table->increments('id');
  25. $table->string('charge_id')->unique();
  26. $table->string('app'); //具体支付配置
  27. $table->string('type'); //业务类型
  28. $table->boolean('paid')->default(false);
  29. $table->boolean('refunded')->default(false);
  30. $table->boolean('reversed')->default(false);
  31. $table->string('channel');
  32. $table->string('order_no');
  33. $table->string('out_trade_no')->nullable();
  34. $table->string('client_ip')->default('127.0.0.1');
  35. $table->integer('amount');
  36. $table->string('currency')->default('cny');
  37. $table->string('subject');
  38. $table->string('body');
  39. $table->text('extra')->nullable();
  40. $table->timestamp('time_paid')->nullable();
  41. $table->timestamp('time_expire')->nullable();
  42. $table->string('transaction_no')->nullable();
  43. $table->text('transaction_meta')->nullable();
  44. $table->text('metadata')->nullable();
  45. $table->text('credential')->nullable();
  46. $table->text('description')->nullable();
  47. $table->string('failure_code')->nullable();
  48. $table->text('failure_msg')->nullable();
  49. $table->timestamps();
  50. $table->softDeletes();
  51. $table->index('order_no');
  52. });
  53. }
  54. }
  55. /**
  56. * Reverse the migrations.
  57. *
  58. * @return void
  59. */
  60. public function down()
  61. {
  62. Schema::dropIfExists('ibrand_pay_charge');
  63. }
  64. }