"What happens if I create a voucher called P66666666 by hand?"
I asked that on October 23, the morning of the day our referral program went to production. The answer started with: it can't exist. The voucher code is a char(8) . PostgreSQL refuses a ninth character, and our admin form stops typing at eight.
Some context. I run backend engineering at GoodBarber , an app platform. Our referral codes are rows in the voucher table that our back office has used for years, a choice explained in a separate post. No migration was allowed for this feature. Every constraint of that table, deliberate or accidental, became a constraint of the referral program.
Eight characters, five other writers
code is the primary key of the voucher table and a column of the usage table, char(8) in both: fixed width, padded with spaces, anything longer refused. Going past eight would have been a migration.
Who else writes to that table?…