20251010100000_create_shipping_templates_table.php 1.0 KB

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