fix(core): prevent sql exception when metastring is interpreted as very large number in egef_metadata

Fixes #7009
fix(upgrade): Ensure that `$CONFIG` is always available to upgrade scripts

Fixes #7457
Merge pull request #7460 from ewinslow/fix-install-upgrade

fix(upgrade): Ensure that `$CONFIG` is always available to upgrade scripts
Merge pull request #7381 from beck24/7009-egef-metadata

fix(core): prevent sql exception when metastring is interpreted as very ...