20251010100100_create_shipping_template_rules_table.php 1.3 KB

123456789101112131415161718192021222324
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateShippingTemplateRulesTable extends Migrator
  5. {
  6. public function change()
  7. {
  8. $table = $this->table('shipping_template_rules');
  9. $table->setId('id')
  10. ->addColumn('template_id', 'integer', ['comment' => '运费模板ID'])
  11. ->addColumn('first', 'decimal', ['precision' => 10, 'scale' => 3, 'comment' => '首件/首重/首体积'])
  12. ->addColumn('first_price', 'decimal', ['precision' => 10, 'scale' => 2, 'comment' => '首件/首重/首体积费用'])
  13. ->addColumn('next_price', 'decimal', ['precision' => 10, 'scale' => 2, 'comment' => '续件/续重/续体积费用'])
  14. ->addColumn('area_type', 'string', ['limit' => 20, 'comment' => '区域类型: default(默认), special(特殊区域)'])
  15. ->addColumn('area_name', 'string', ['limit' => 100, 'comment' => '区域名称,如:偏远地区、江浙沪等', 'null' => true])
  16. ->addColumn('regions', 'json', ['comment' => '地区信息(JSON格式,省级行政区划,包含地区编码和名称)', 'null' => true])
  17. ->addTimestamps('create_time', 'update_time')
  18. ->addIndex(['template_id'])
  19. ->addIndex(['area_type'])
  20. ->create();
  21. }
  22. }