Files
cursoradminapiformjifengqiang/database/migrations/20240212002_agent_codes.php
2025-02-12 10:45:49 +08:00

25 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use think\migration\Migrator;
use think\migration\db\Column;
class AgentCodes extends Migrator
{
public function change()
{
$table = $this->table('cursor_agent_codes', ['engine' => 'InnoDB']);
$table->addColumn('agent_id', 'integer', ['null' => false, 'comment' => '代理商ID'])
->addColumn('code_id', 'integer', ['null' => false, 'comment' => '激活码ID'])
->addColumn('price', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '销售价格'])
->addColumn('commission', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '佣金'])
->addColumn('parent_commission', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '上级佣金'])
->addColumn('status', 'integer', ['limit' => 1, 'null' => false, 'default' => 0, 'comment' => '状态0=未结算1=已结算'])
->addColumn('settle_time', 'datetime', ['null' => true, 'comment' => '结算时间'])
->addColumn('created_at', 'datetime', ['null' => false, 'comment' => '创建时间'])
->addColumn('updated_at', 'datetime', ['null' => false, 'comment' => '更新时间'])
->addIndex(['agent_id'])
->addIndex(['code_id'])
->addIndex(['status'])
->create();
}
}