In this example where users may already exist, I would have a rake task which would populate the tokens for the users. Once the tokens have been generated, I would have another migration which would set the column to a `null: false`.
But I believe your confusion is valid as it should be `unless` instead of `if`.
`break if self.class.exists?(token: token)` would cause an endless loop while `break unless self.class.exists?(token: token)` would give the desired functionality.