[1.7.x] Fixed #24051 -- Made schema infrastructure honor tablespaces

Partial backport of 30cbd5d36. Thanks Douglas J. Reynolds for the
report and initial patch.
suggested wording: ```Added tablespace SQL to apps with migrations (:ticket:`24051`).```