refactored note attachment into note ancillary

This commit is contained in:
zadam
2023-01-28 13:13:46 +01:00
parent 78954268ab
commit 37ba76fdd8
30 changed files with 212 additions and 211 deletions

View File

@@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS "note_attachments"
CREATE TABLE IF NOT EXISTS "note_ancillaries"
(
noteAttachmentId TEXT not null primary key,
noteAncillaryId TEXT not null primary key,
noteId TEXT not null,
name TEXT not null,
mime TEXT not null,
@@ -10,11 +10,11 @@ CREATE TABLE IF NOT EXISTS "note_attachments"
isDeleted INT not null,
`deleteId` TEXT DEFAULT NULL);
CREATE TABLE IF NOT EXISTS "note_attachment_contents" (`noteAttachmentId` TEXT NOT NULL PRIMARY KEY,
CREATE TABLE IF NOT EXISTS "note_ancillary_contents" (`noteAncillaryId` TEXT NOT NULL PRIMARY KEY,
`content` TEXT DEFAULT NULL,
`utcDateModified` TEXT NOT NULL);
CREATE INDEX IDX_note_attachments_name
on note_attachments (name);
CREATE UNIQUE INDEX IDX_note_attachments_noteId_name
on note_attachments (noteId, name);
CREATE INDEX IDX_note_ancillaries_name
on note_ancillaries (name);
CREATE UNIQUE INDEX IDX_note_ancillaries_noteId_name
on note_ancillaries (noteId, name);

View File

@@ -29,11 +29,11 @@ module.exports = async () => {
}
}
catch (e) {
log.info(`Could not create a note attachment for canvas "${note.noteId}" with error: ${e.message} ${e.stack}`);
log.info(`Could not create a note ancillary for canvas "${note.noteId}" with error: ${e.message} ${e.stack}`);
continue;
}
note.saveNoteAttachment('canvasSvg', 'image/svg+xml', svg);
note.saveNoteAncillary('canvasSvg', 'image/svg+xml', svg);
}
});
};
};

View File

@@ -112,9 +112,9 @@ CREATE TABLE IF NOT EXISTS "recent_notes"
notePath TEXT not null,
utcDateCreated TEXT not null
);
CREATE TABLE IF NOT EXISTS "note_attachments"
CREATE TABLE IF NOT EXISTS "note_ancillaries"
(
noteAttachmentId TEXT not null primary key,
noteAncillaryId TEXT not null primary key,
noteId TEXT not null,
name TEXT not null,
mime TEXT not null,
@@ -123,10 +123,10 @@ CREATE TABLE IF NOT EXISTS "note_attachments"
utcDateModified TEXT not null,
isDeleted INT not null,
`deleteId` TEXT DEFAULT NULL);
CREATE TABLE IF NOT EXISTS "note_attachment_contents" (`noteAttachmentId` TEXT NOT NULL PRIMARY KEY,
CREATE TABLE IF NOT EXISTS "note_ancillary_contents" (`noteAncillaryId` TEXT NOT NULL PRIMARY KEY,
`content` TEXT DEFAULT NULL,
`utcDateModified` TEXT NOT NULL);
CREATE INDEX IDX_note_attachments_name
on note_attachments (name);
CREATE UNIQUE INDEX IDX_note_attachments_noteId_name
on note_attachments (noteId, name);
CREATE INDEX IDX_note_ancillaries_name
on note_ancillaries (name);
CREATE UNIQUE INDEX IDX_note_ancillaries_noteId_name
on note_ancillaries (noteId, name);