20251010100200_create_shipping_template_relations_table.php 822 B

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