diff --git a/migrations/0001__cleanup_tables.sql b/migrations/0001__cleanup_tables.sql index b78cf7626..89b7355c5 100644 --- a/migrations/0001__cleanup_tables.sql +++ b/migrations/0001__cleanup_tables.sql @@ -1,11 +1,11 @@ -DROP TABLE anchors; -DROP TABLE attachments; -DROP TABLE bookmarks; -DROP TABLE custom_properties; -DROP TABLE deletions; -DROP TABLE deletions_attachments; -DROP TABLE formatting; -DROP TABLE icons; -DROP TABLE tags; -DROP TABLE tags_notes; -DROP TABLE tasks; \ No newline at end of file +DROP TABLE IF EXISTS anchors; +DROP TABLE IF EXISTS attachments; +DROP TABLE IF EXISTS bookmarks; +DROP TABLE IF EXISTS custom_properties; +DROP TABLE IF EXISTS deletions; +DROP TABLE IF EXISTS deletions_attachments; +DROP TABLE IF EXISTS formatting; +DROP TABLE IF EXISTS icons; +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS tags_notes; +DROP TABLE IF EXISTS tasks; \ No newline at end of file diff --git a/routes/api/notes.js b/routes/api/notes.js index 9508488f5..f3b6ef80b 100644 --- a/routes/api/notes.js +++ b/routes/api/notes.js @@ -21,7 +21,6 @@ router.get('/:noteId', auth.checkApiAuth, async (req, res, next) => { res.send({ 'detail': detail, - 'links': await sql.getResults("select * from links where note_id = ? order by note_offset", [noteId]), 'images': await sql.getResults("select * from images where note_id = ? order by note_offset", [noteId]) }); }); diff --git a/services/migration.js b/services/migration.js index 90111cf11..05b89ecc1 100644 --- a/services/migration.js +++ b/services/migration.js @@ -22,9 +22,9 @@ async function migrate() { const name = match[2]; const migrationRecord = { - 'db_version': dbVersion, - 'name': name, - 'file': file + dbVersion: dbVersion, + name: name, + file: file }; migrations.push(migrationRecord); @@ -44,6 +44,8 @@ async function migrate() { await sql.executeScript(migrationSql); + await sql.setOption("db_version", mig.dbVersion); + await sql.commit(); mig['success'] = true;