20250728173547_extension_balpay_log.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. use think\migration\db\Column;
  4. use think\migration\Migrator;
  5. class ExtensionBalpayLog extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change(): void
  29. {
  30. $table = $this->table('extension_balpay_log', ['commonts' => '余额支付日志']);
  31. $table->addColumn(Column::integer('user_id')->setUnsigned()->setComment('用户ID'))
  32. ->addColumn(Column::integer('order_id')->setUnsigned()->setDefault(0)->setComment('订单ID(可为0)'))
  33. ->addColumn(Column::integer('type')->setUnsigned()->setDefault(0)->setComment('流水类型:1-充值 2-消费 3-退款 4-冻结 5-解冻'))
  34. ->addColumn(Column::decimal('amount', 10, 2)->setComment('金额'))
  35. ->addColumn(Column::decimal('balance', 10, 2)->setComment('当前余额'))
  36. ->addColumn(Column::string('description')->setLimit(255)->setComment('描述'))
  37. ->addTimestamps()
  38. ->create();
  39. }
  40. }