New way to calculate the total tuple count
Context:
The batched background migration framework now supports filters and relations. The current way we calculate total_tuple_count
does not work anymore since we use a cardinality estimation without applying the migration class scopes.
Current implementation: https://gitlab.com/gitlab-org/gitlab/-/blame/52ea3ecf72c63764d3959ae12fff55651305b9a8/lib/gitlab/database/pg_class.rb#L14
Edited by Diogo Frazão