“rename_discourse_rewind_disabled_to_enabled”中的迁移错误

感谢您运行这些查询,@Don - 您已经确认了根本原因 :raising_hands:

您的结果完全证实了我们的猜测

  1. 您有一个包含 user_options 副本的 backup 模式(schema)
  2. 该表仍然具有旧的默认值(column_default = false
  3. backup 行出现在查询结果的顺序中在 public 之前

当迁移删除了 public.user_options 上的默认值时,它没有触及 backup.user_options。然后 mark_readonly 查询了 information_schema.columns 而没有按模式(schema)过滤,首先获取了 backup 行(该行仍然具有默认值),然后失败了 :collision:

修复方法是简单地向查询中添加 table_schema = 'public',以便它只检查迁移实际操作的模式。

4 个赞