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