20251010100200_create_shipping_template_relations_table.php 791 B

1234567891011121314151617181920
  1. <?php
  2. use think\migration\Migrator;
  3. class CreateShippingTemplateRelationsTable extends Migrator
  4. {
  5. public function change()
  6. {
  7. $table = $this->table('shipping_template_relations');
  8. $table->addColumn('template_id', 'integer', ['comment' => '运费模板ID'])
  9. ->addColumn('biz_type', 'string', ['limit' => 50, 'comment' => '业务类型: goods(商品), category(商品分类), shop(店铺)等'])
  10. ->addColumn('biz_id', 'integer', ['comment' => '业务实体ID'])
  11. ->addTimestamps('create_time', 'update_time')
  12. ->addIndex(['template_id'])
  13. ->addIndex(['biz_type'])
  14. ->addIndex(['biz_id'])
  15. ->addIndex(['template_id', 'biz_type', 'biz_id'], ['unique' => true])
  16. ->create();
  17. }
  18. }