returnparseInt(sql.getValue("SELECT value FROM options WHERE name = 'dbVersion'"));
}
functionisDbUpToDate(){
constdbVersion=getDbVersion();
constupToDate=dbVersion>=appInfo.dbVersion;
if(!upToDate){
log.info("App db version is "+appInfo.dbVersion+", while db version is "+dbVersion+". Migration needed.");
}
returnupToDate;
}
constsqlInit=require('./sql_init');
asyncfunctionmigrateIfNecessary(){
constcurrentDbVersion=getDbVersion();
if(currentDbVersion>appInfo.dbVersion){
log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`);
log.info(`DB not initialized, please visit setup page`+(utils.isElectron()?'':` - http://[your-server-host]:${port} to see instructions on how to initialize Trilium.`));
return;
}
constcurrentDbVersion=getDbVersion();
if(currentDbVersion>appInfo.dbVersion){
log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`);