You can either eat night shades or avoid them, but you shouldn’t be worrying about solanine either way.
Solanine mostly accumulates in the leaves and stems of either plant so just avoid those parts and you’ll be fine. The literal only time you should care is if a potato has turned green.
Ripe tomatoes contain virtually no solanine. There are some slight differences between varieties, but most that have been tested measured 0 when fully ripe. Even when green, they contain a smaller amount than is found in the same weight of most potato varieties.