it's now possible to mark relation as inheritable (previously this was hardcoded for specific relation names)

This commit is contained in:
azivner
2018-07-29 20:33:42 +02:00
parent ed1381103a
commit 2eb1a9705f
9 changed files with 18 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
const build = require('./build');
const packageJson = require('../../package');
const APP_DB_VERSION = 106;
const APP_DB_VERSION = 107;
const SYNC_VERSION = 1;
module.exports = {

View File

@@ -46,7 +46,8 @@ async function getEffectiveRelations(noteId) {
JOIN notes ON notes.noteId = branches.parentNoteId
WHERE notes.isDeleted = 0 AND branches.isDeleted = 0
)
SELECT relations.* FROM relations JOIN tree ON relations.sourceNoteId = tree.noteId WHERE relations.isDeleted = 0 AND relations.name IN ('runOnNoteView')`, [noteId]);
SELECT relations.* FROM relations JOIN tree ON relations.sourceNoteId = tree.noteId
WHERE relations.isDeleted = 0 AND (relations.isInheritable = 1 OR relations.sourceNoteId = ?)`, [noteId, noteId]);
}
module.exports = {

View File

@@ -40,7 +40,7 @@ async function updateEntity(sync, entity, sourceId) {
await updateApiToken(entity, sourceId);
}
else {
throw new Error(`Unrecognized entity type ${sync}`);
throw new Error(`Unrecognized entity type ${entityName}`);
}
}