Add env packages our first patch yay

Modifies the database so environmental packages are stored in the database.

The initialize.sql file has been moved to be the first patch.
@antgonza the live database will need to be modified running the following sql statement:
```sql
UPDATE settings SET current_patch = '0.sql';
```
The reason is that initialize is now the patch 0.

This PR also reduces some code duplication on reseting the test database