| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class UserPointLog 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()
- {
- // 用户积分日志表
- $table = $this->table('extension_user_point_log',[
- 'collation' => 'utf8mb4_unicode_ci',
- 'comment' => '用户积分日志表',
- ]);
- $table->addColumn('user_id', Column::INTEGER, ['signed' => false, 'comment' => '用户ID'])
- ->addColumn('point', Column::INTEGER, ['signed' => true, 'default' => 0, 'comment' => '积分'])
- ->addColumn('freeze_point', Column::INTEGER, ['signed' => true, 'default' => 0, 'comment' => '冻结积分'])
- ->addColumn('type', Column::INTEGER, ['signed' => false, 'default' => 0, 'comment' => '类型 1 新增 2 减少 3 对冲'])
- ->addColumn('biz_type', Column::TINYINTEGER, ['signed' => false, 'default' => 0, 'comment' => '关联业务类型 1 订单'])
- ->addColumn('biz_id', Column::INTEGER, ['signed' => false, 'default' => 0, 'comment' => '关联业务ID'])
- ->addColumn('remark', Column::STRING, ['default' => '', 'comment' => '备注'])
- ->addTimestamps()
- ->addIndex('user_id')
- ->create();
- }
- }
|