Upgrade DB code and DB to SQLite3