create_payment_tables.php.sub 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * This file is part of ibrand/payment.
  4. *
  5. * (c) iBrand <https://www.ibrand.cc>
  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\Database\Migrations\Migration;
  11. use Illuminate\Database\Schema\Blueprint;
  12. use Illuminate\Support\Facades\Schema;
  13. class CreatePaymentTables extends Migration
  14. {
  15. /**
  16. * Run the migrations.
  17. *
  18. * @return void
  19. */
  20. public function up()
  21. {
  22. $prefix = config('ibrand.app.database.prefix', 'ibrand_');
  23. if(!Schema::hasTable($prefix . 'payment')){
  24. Schema::create($prefix . 'payment', function (Blueprint $table) {
  25. $table->increments('id');
  26. $table->integer('order_id')->unsigned(); //关联的订单号
  27. $table->string('channel'); //支付渠道
  28. $table->string('channel_no')->nullable(); //取单的支付单号
  29. $table->integer('amount'); //本次支付的金额
  30. $table->string('status');
  31. $table->text('details')->nullable(); //存储json meta 数据
  32. $table->timestamp('paid_at')->nullable(); //支付时间
  33. $table->timestamps();
  34. $table->softDeletes();
  35. });
  36. }
  37. }
  38. /**
  39. * Reverse the migrations.
  40. *
  41. * @return void
  42. */
  43. public function down()
  44. {
  45. $prefix = config('ibrand.app.database.prefix', 'ibrand_');
  46. Schema::drop($prefix . 'payment');
  47. }
  48. }