Store templates_id to provide more useful logs

Storing templates_id required minor change (addition of one field) to
custom database table used to store changelog data. Two new variables
(config option schema_version and constant SCHEMA_VERSION) and method
updateDatabaseSchema() were itroduced specifically for this purpose.