Revised ThingStackDB.sql script