DEV: Correct historical posts table schema discrepancies (PR #10014)

This is a no-op for modern installations. It only affects older sites.

Follow-up to f7d676dce19bc44f969d6b84ec820e2c72da3903

This needs to be done in a transaction, because we need to drop and recreate the badge_posts view.

GitHub