fix: change postal_code column from integer to string (#1585)

* fix: change postal_code column from integer to string

Allows non-numeric postal codes such as UK format (e.g. SW1A 2AA).
The integer column was silently dropping any alphanumeric input.

The migration is marked irreversible — once alphanumeric postal codes
exist, they cannot be safely cast back to integer.

* fix: update schema.rb, quote fixture postal_code, and add alphanumeric test

* fix: use conventional migration timestamp
This commit is contained in:
Will Wilson
2026-04-29 14:30:04 +01:00
committed by GitHub
parent c9f9e04071
commit ad23820a2e
4 changed files with 18 additions and 3 deletions

View File

@@ -39,6 +39,12 @@ class AddressTest < ActiveSupport::TestCase
assert_equal "", address.to_s
end
test "accepts alphanumeric postal codes" do
address = addresses(:one)
address.update!(postal_code: "SW1A 2AA")
assert_equal "SW1A 2AA", address.reload.postal_code
end
test "can strip extras commas and spaces" do
address = Address.new(
line1: "123 Main St ,",