mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Merge branch 'stable'
# Conflicts: # package.json # src/services/build.js # src/services/migration.js
This commit is contained in:
commit
92e8b155e4
@ -8,3 +8,6 @@ CREATE TABLE IF NOT EXISTS "blobs" (
|
|||||||
|
|
||||||
ALTER TABLE notes ADD blobId TEXT DEFAULT NULL;
|
ALTER TABLE notes ADD blobId TEXT DEFAULT NULL;
|
||||||
ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL;
|
ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL;
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS IDX_notes_blobId on notes (blobId);
|
||||||
|
CREATE INDEX IF NOT EXISTS IDX_note_revisions_blobId on note_revisions (blobId);
|
||||||
|
@ -21,5 +21,6 @@ CREATE INDEX `IDX_revisions_utcDateCreated` ON `revisions` (`utcDateCreated`);
|
|||||||
CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`);
|
CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`);
|
||||||
CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`);
|
CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`);
|
||||||
CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`);
|
CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`);
|
||||||
|
CREATE INDEX IF NOT EXISTS IDX_revisions_blobId on revisions (blobId);
|
||||||
|
|
||||||
UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions';
|
UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions';
|
||||||
|
@ -19,3 +19,5 @@ CREATE INDEX IDX_attachments_ownerId_role
|
|||||||
|
|
||||||
CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince
|
CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince
|
||||||
on attachments (utcDateScheduledForErasureSince);
|
on attachments (utcDateScheduledForErasureSince);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS IDX_attachments_blobId on attachments (blobId);
|
||||||
|
@ -1 +1 @@
|
|||||||
module.exports = { buildDate:"2024-01-12T00:02:50+01:00", buildRevision: "17e063f01d3b6c7a601630feaa96191d26095650" };
|
module.exports = { buildDate:"2024-01-21T23:49:23+01:00", buildRevision: "4f8073daa7cff1b8b6737ae45792b2e87c2adf33" };
|
||||||
|
@ -48,6 +48,14 @@ function isEntityEventsDisabled() {
|
|||||||
return !!namespace.get('disableEntityEvents');
|
return !!namespace.get('disableEntityEvents');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMigrationRunning(running) {
|
||||||
|
namespace.set('migrationRunning', !!running);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMigrationRunning() {
|
||||||
|
return !!namespace.get('migrationRunning');
|
||||||
|
}
|
||||||
|
|
||||||
function disableSlowQueryLogging(disable) {
|
function disableSlowQueryLogging(disable) {
|
||||||
namespace.set('disableSlowQueryLogging', disable);
|
namespace.set('disableSlowQueryLogging', disable);
|
||||||
}
|
}
|
||||||
@ -102,5 +110,7 @@ module.exports = {
|
|||||||
putEntityChange,
|
putEntityChange,
|
||||||
ignoreEntityChangeIds,
|
ignoreEntityChangeIds,
|
||||||
disableSlowQueryLogging,
|
disableSlowQueryLogging,
|
||||||
isSlowQueryLoggingDisabled
|
isSlowQueryLoggingDisabled,
|
||||||
|
setMigrationRunning,
|
||||||
|
isMigrationRunning
|
||||||
};
|
};
|
||||||
|
@ -5,12 +5,13 @@ const log = require('./log.js');
|
|||||||
const utils = require('./utils.js');
|
const utils = require('./utils.js');
|
||||||
const resourceDir = require('./resource_dir.js');
|
const resourceDir = require('./resource_dir.js');
|
||||||
const appInfo = require('./app_info.js');
|
const appInfo = require('./app_info.js');
|
||||||
|
const cls = require('./cls.js');
|
||||||
|
|
||||||
async function migrate() {
|
async function migrate() {
|
||||||
const currentDbVersion = getDbVersion();
|
const currentDbVersion = getDbVersion();
|
||||||
|
|
||||||
if (currentDbVersion < 214) {
|
if (currentDbVersion < 214) {
|
||||||
log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.60.X first and only then to this version.");
|
log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.60.4 first and only then to this version.");
|
||||||
|
|
||||||
utils.crash();
|
utils.crash();
|
||||||
return;
|
return;
|
||||||
@ -18,7 +19,7 @@ async function migrate() {
|
|||||||
|
|
||||||
// backup before attempting migration
|
// backup before attempting migration
|
||||||
await backupService.backupNow(
|
await backupService.backupNow(
|
||||||
// creating a special backup for versions 0.60.X, the changes in 0.61 are major.
|
// creating a special backup for version 0.60.4, the changes in 0.61 are major.
|
||||||
currentDbVersion === 214
|
currentDbVersion === 214
|
||||||
? `before-migration-v060`
|
? `before-migration-v060`
|
||||||
: 'before-migration'
|
: 'before-migration'
|
||||||
@ -51,6 +52,9 @@ async function migrate() {
|
|||||||
// all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version
|
// all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version
|
||||||
// otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app,
|
// otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app,
|
||||||
// and too old for the new app version.
|
// and too old for the new app version.
|
||||||
|
|
||||||
|
cls.setMigrationRunning(true);
|
||||||
|
|
||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
for (const mig of migrations) {
|
for (const mig of migrations) {
|
||||||
try {
|
try {
|
||||||
|
@ -895,6 +895,11 @@ function scanForLinks(note, content) {
|
|||||||
* Things which have to be executed after updating content, but asynchronously (separate transaction)
|
* Things which have to be executed after updating content, but asynchronously (separate transaction)
|
||||||
*/
|
*/
|
||||||
async function asyncPostProcessContent(note, content) {
|
async function asyncPostProcessContent(note, content) {
|
||||||
|
if (cls.isMigrationRunning()) {
|
||||||
|
// this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (note.hasStringContent() && !utils.isString(content)) {
|
if (note.hasStringContent() && !utils.isString(content)) {
|
||||||
content = content.toString();
|
content = content.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user