Feature db script texts

Appears to be everything working

Remaining TODOs:
* Fix various checking of IDs
* Some code cleanup
* Proper sausage-making: http://justinhileman.info/article/changing-history/