Implement version check

* Code that checks and writes schema version to 'meta' table.
* Update code for possible future schema updates.