20251010100100_create_shipping_template_rules_table.php 1.2 KB

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