Multi-environment database operations

All DB tasks now operate on both the development and test environments (or whichever are available).

Mostly reworked from #37.