-- Retroactively fills in the researched key format (see
-- Platform::suggestedKeyFormatPattern(), added in 0.4.4) for any existing
-- platform that matches one of the three recognized template families and
-- doesn't already have a pattern set -- 0.4.4 itself only pre-filled new
-- platforms created after that release. The IS NULL guard means this never
-- overwrites a pattern an admin already configured by hand.
UPDATE platforms SET key_format_pattern = '[BCDFGHJKMNPQRTVWXYZ2346789]{5}(-[BCDFGHJKMNPQRTVWXYZ2346789]{5}){4}'
  WHERE label = 'Xbox/Microsoft Store' AND key_format_pattern IS NULL;

UPDATE platforms SET key_format_pattern = '[A-HJ-NP-Y0-9]{16}'
  WHERE label LIKE 'Nintendo Switch%' AND key_format_pattern IS NULL;

UPDATE platforms SET key_format_pattern = '[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}'
  WHERE label LIKE 'PlayStation%' AND key_format_pattern IS NULL;
