change in naming of SQL methods

added assert methods to note tree
This commit is contained in:
azivner
2017-12-23 11:02:38 -05:00
parent c07c18f08a
commit bd2a5f6d82
27 changed files with 139 additions and 85 deletions

View File

@@ -54,10 +54,10 @@ async function cleanupSyncRowsForMissingEntities(entityName, entityKey) {
async function fillSyncRows(entityName, entityKey) {
await cleanupSyncRowsForMissingEntities(entityName, entityKey);
const entityIds = await sql.getFlattenedResults(`SELECT ${entityKey} FROM ${entityName}`);
const entityIds = await sql.getFirstColumn(`SELECT ${entityKey} FROM ${entityName}`);
for (const entityId of entityIds) {
const existingRows = await sql.getSingleValue("SELECT COUNT(id) FROM sync WHERE entity_name = ? AND entity_id = ?", [entityName, entityId]);
const existingRows = await sql.getFirstValue("SELECT COUNT(id) FROM sync WHERE entity_name = ? AND entity_id = ?", [entityName, entityId]);
// we don't want to replace existing entities (which would effectively cause full resync)
if (existingRows === 0) {