20251010100100_create_shipping_template_rules_table.php 1.1 KB

1234567891011121314151617181920212223
  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('regions', 'json', ['comment' => '地区信息(JSON格式,省级行政区划,包含地区编码和名称)', 'null' => true])
  16. ->addTimestamps('create_time', 'update_time')
  17. ->addIndex(['template_id'])
  18. ->addIndex(['area_type'])
  19. ->create();
  20. }
  21. }