Migration error in 'rename_discourse_rewind_disabled_to_enabled'

Thanks for running those queries @Don - you’ve confirmed the root cause :raising_hands:

Your results show exactly what we suspected

  1. You have a backup schema with a copy of user_options
  2. That table still has the old default (column_default = false)
  3. The backup row appeared before public in the query results

When the migration dropped the default on public.user_options, it didn’t touch backup.user_options. Then mark_readonly queried information_schema.columns without filtering by schema, got the backup row first (which still had the default), and failed :collision:

The fix is to simply add table_schema = 'public' to the query so it only checks the schema that migrations actually operate on.

4 Likes