I just came across this when creating a new local db and migrating.
Unfortunately I think it was introduced by FIX: reset cache after flags are seed by lis2 · Pull Request #28801 · discourse/discourse · GitHub. Brand new migrations from scratch are not possible now.
@kris.kotlarek could you have a look please. I believe touching the redis cache in the initializer could be the issue.