20251207111526_limit_purchase_rule.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. final class LimitPurchaseRule extends AbstractMigration
  5. {
  6. public function change(): void
  7. {
  8. $this->table('limit_purchase_rule', ['comment' => '限购规则表'])
  9. ->addColumn('name', 'string', [
  10. 'length' => 64,
  11. 'comment' => '规则名称',
  12. ])
  13. ->addColumn('regions', 'json', [
  14. 'null' => true,
  15. 'comment' => '限购地区 JSON',
  16. ])
  17. ->addColumn('is_default', 'tinyinteger', [
  18. 'limit' => 1,
  19. 'signed' => false,
  20. 'default' => 0,
  21. 'comment' => '是否默认规则:0 否,1 是',
  22. ])
  23. ->addColumn('status', 'tinyinteger', [
  24. 'limit' => 1,
  25. 'signed' => false,
  26. 'default' => 1,
  27. 'comment' => '状态:1 启用,0 停用',
  28. ])
  29. ->addTimestamps('create_time', 'update_time')
  30. ->addColumn('delete_time', 'timestamp')
  31. ->create();
  32. }
  33. }