Commit c3f8df7
fix(promo-codes): harden CSV domain import and migration rollback safety
CSV import — blank allowed_email_domains cells produced [''] after
explode, which passed the empty() check on the array but caused
matchesEmailDomain() to reject every email (empty pattern is skipped,
no match found, returns false). Now trims whitespace, filters empty
strings, and unsets the key if no valid domains remain.
Migration down() — replaced DELETE with UPDATE to remap domain-authorized
rows to base types (discount→SummitRegistrationDiscountCode,
promo→SummitRegistrationPromoCode). DELETE would silently cascade through
SummitAttendeeTicket.PromoCodeID (ON DELETE CASCADE), destroying ticket
history. UPDATE preserves FK references while safely narrowing the ENUM.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent ae261a7 commit c3f8df7
2 files changed
Lines changed: 19 additions & 7 deletions
File tree
- app/Services/Model/Imp
- database/migrations/model
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
647 | 650 | | |
648 | 651 | | |
649 | 652 | | |
| |||
750 | 753 | | |
751 | 754 | | |
752 | 755 | | |
753 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
754 | 760 | | |
755 | 761 | | |
756 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
0 commit comments