fixed recent notes according to updated schema

This commit is contained in:
azivner 2017-12-14 22:31:49 -05:00
parent 1fdea480d3
commit e9e92f93b3

View File

@ -25,7 +25,7 @@ function checkMissing(table, name, ids1, ids2) {
} }
} }
function compareRows(table, rsLeft, rsRight) { function compareRows(table, rsLeft, rsRight, column) {
const leftIds = Object.keys(rsLeft); const leftIds = Object.keys(rsLeft);
const rightIds = Object.keys(rsRight); const rightIds = Object.keys(rsRight);
@ -39,7 +39,7 @@ function compareRows(table, rsLeft, rsRight) {
const right = JSON.stringify(rsRight[id], null, 2); const right = JSON.stringify(rsRight[id], null, 2);
if (left !== right) { if (left !== right) {
console.log("Table " + table + " row id=" + id + " differs:"); console.log("Table " + table + " row with " + column + "=" + id + " differs:");
console.log("Left: ", left); console.log("Left: ", left);
console.log("Right: ", right); console.log("Right: ", right);
printDiff(left, right); printDiff(left, right);
@ -58,13 +58,13 @@ async function main() {
const rsLeft = await sql.getIndexed(dbLeft, column, query); const rsLeft = await sql.getIndexed(dbLeft, column, query);
const rsRight = await sql.getIndexed(dbRight, column, query); const rsRight = await sql.getIndexed(dbRight, column, query);
compareRows(table, rsLeft, rsRight); compareRows(table, rsLeft, rsRight, column);
} }
await compare("notes_tree", "note_tree_id", "SELECT note_tree_id, note_id, note_pid, note_pos, date_modified, is_deleted, prefix FROM notes_tree"); await compare("notes_tree", "note_tree_id", "SELECT note_tree_id, note_id, note_pid, note_pos, date_modified, is_deleted, prefix FROM notes_tree");
await compare("notes", "note_id", "SELECT note_id, note_title, note_text, date_modified, is_protected, is_deleted FROM notes"); await compare("notes", "note_id", "SELECT note_id, note_title, note_text, date_modified, is_protected, is_deleted FROM notes");
await compare("notes_history", "note_history_id", "SELECT note_history_id, note_id, note_title, note_text, date_modified_from, date_modified_to, is_protected FROM notes_history"); await compare("notes_history", "note_history_id", "SELECT note_history_id, note_id, note_title, note_text, date_modified_from, date_modified_to, is_protected FROM notes_history");
await compare("recent_notes", "note_path", "SELECT note_path, date_accessed, is_deleted FROM recent_notes"); await compare("recent_notes", "note_tree_id", "SELECT note_tree_id, note_path, date_accessed, is_deleted FROM recent_notes");
await compare("options", "opt_name", "SELECT opt_name, opt_value FROM options " + await compare("options", "opt_name", "SELECT opt_name, opt_value FROM options " +
"WHERE opt_name IN ('username', 'password_verification_hash', 'encrypted_data_key', 'protected_session_timeout', 'history_snapshot_time_interval')"); "WHERE opt_name IN ('username', 'password_verification_hash', 'encrypted_data_key', 'protected_session_timeout', 'history_snapshot_time_interval')");
} }