20250728173547_extension_balpay_log.php 1.6 KB

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