20251208203054_goods_limit_purchase_rule.php 794 B

12345678910111213141516171819202122232425
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. final class GoodsLimitPurchaseRule extends AbstractMigration
  5. {
  6. public function change(): void
  7. {
  8. $this->table('goods_limit_purchase_rule', ['comment' => '商品限购规则关联表'])
  9. ->addColumn('goods_id', 'integer', [
  10. 'signed' => false,
  11. 'comment' => '商品ID',
  12. ])
  13. ->addColumn('rule_id', 'integer', [
  14. 'signed' => false,
  15. 'comment' => '限购规则ID',
  16. ])
  17. ->addTimestamps('create_time', 'update_time')
  18. ->addIndex(['goods_id'], ['unique' => true, 'name' => 'uk_goods_id'])
  19. ->addIndex(['rule_id'], ['name' => 'idx_rule_id'])
  20. ->create();
  21. }
  22. }