| 1234567891011121314151617181920 |
- <?php
- class CreateShippingTemplatesTable extends \Phinx\Migration\AbstractMigration
- {
- public function change()
- {
- $table = $this->table('shipping_templates');
- $table->addColumn('name', 'string', ['limit' => 100, 'comment' => '模板名称'])
- ->addColumn('calc_method', 'string', ['limit' => 20, 'comment' => '计费方式: piece(按件), weight(按重量), volume(按体积)'])
- ->addColumn('unit', 'string', ['limit' => 10, 'comment' => '单位: 件,g,kg,cm3,m3', 'default' => 'piece'])
- ->addColumn('status', 'integer', ['limit' => 1, 'comment' => '状态: 0(禁用), 1(启用)', 'default' => 1])
- ->addColumn('sort', 'integer', ['comment' => '排序', 'default' => 100])
- ->addTimestamps('create_time', 'update_time')
- ->addColumn('delete_time', 'timestamp', ['comment' => '删除时间', 'null' => true])
- ->addIndex(['name'])
- ->addIndex(['status'])
- ->addIndex(['sort'])
- ->create();
- }
- }
|