unifying surrogate keys for event log and options, fixes #103

This commit is contained in:
azivner
2018-05-26 23:25:09 -04:00
parent a30734f1bc
commit cab54a458f
6 changed files with 41 additions and 21 deletions

View File

@@ -3,7 +3,7 @@
const build = require('./build');
const packageJson = require('../../package');
const APP_DB_VERSION = 95;
const APP_DB_VERSION = 96;
module.exports = {
appVersion: packageJson.version,

View File

@@ -1,5 +1,6 @@
const sql = require('./sql');
const dateUtils = require('./date_utils');
const utils = require('./utils');
const log = require('./log');
async function addEvent(comment) {
@@ -8,9 +9,10 @@ async function addEvent(comment) {
async function addNoteEvent(noteId, comment) {
await sql.insert('event_log', {
noteId : noteId,
comment: comment,
dateCreated: dateUtils.nowDate()
eventId: utils.newEntityId(),
noteId : noteId,
comment: comment,
dateCreated: dateUtils.nowDate()
});
log.info("Event log for " + noteId + ": " + comment);

View File

@@ -207,13 +207,12 @@ const primaryKeys = {
"notes": "noteId",
"branches": "branchId",
"note_revisions": "noteRevisionId",
"option": "name",
"recent_notes": "branchId",
"images": "imageId",
"note_images": "noteImageId",
"labels": "labelId",
"api_tokens": "apiTokenId",
"options": "name"
"options": "optionId"
};
async function getEntityRow(entityName, entityId) {