[1.7.x] Fixed #24054 -- Enabled sqlsequencereset for apps with migrations.

Backport of c2e419c26781b88f2b34b445f450b735267155b0 from master