Skip to content

Commit 2fa9345

Browse files
authored
Merge pull request #11241 from neinteractiveliterature/fix-bucket-key-null-constraint-migration
Clear historic bucket_keys before adding null constraint
2 parents 70083e7 + 937bb6e commit 2fa9345

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

db/migrate/20260321193050_add_bucket_key_null_constraint_to_signups.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
class AddBucketKeyNullConstraintToSignups < ActiveRecord::Migration[8.1]
22
def up
3+
# Clear bucket_key on withdrawn/waitlisted signups that predate the fix in EventWithdrawService
4+
# (prior to March 2020, withdrawals did not null out bucket_key)
5+
execute <<~SQL
6+
UPDATE signups SET bucket_key = NULL
7+
WHERE state NOT IN ('confirmed', 'ticket_purchase_hold')
8+
AND bucket_key IS NOT NULL
9+
SQL
10+
311
execute <<~SQL
412
ALTER TABLE signups
513
ADD CONSTRAINT bucket_key_null_for_non_slot_occupying_states

0 commit comments

Comments
 (0)