| 123456789101112131415161718192021222324252627 |
- <?php
- use Phinx\Db\Adapter\MysqlAdapter;
- use think\migration\Migrator;
- class CreateCurrency extends Migrator
- {
- public function change(): void {
- $table = $this->table('currency', [
- 'id' => 'id',
- 'engine' => 'InnoDB',
- 'collation' => 'utf8mb4_general_ci',
- 'comment' => '币种字典表',
- 'auto_id' => true,
- ]);
- $table
- ->addColumn('code', 'string', ['limit' => 8, 'null' => false, 'default' => '', 'comment' => '币种代码(ISO 4217,业务唯一键)'])
- ->addColumn('title', 'string', ['limit' => 50, 'null' => false, 'default' => '', 'comment' => '币种名称'])
- ->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
- ->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '状态:0禁用,1启用'])
- ->addColumn('create_time', 'biginteger', ['null' => false, 'default' => 0, 'comment' => '创建时间'])
- ->addColumn('delete_time', 'biginteger', ['null' => false, 'default' => 0, 'comment' => '删除时间'])
- ->addIndex(['code'], ['name' => 'idx_code'])
- ->create();
- }
- }
|