mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
relation between notes and images
This commit is contained in:
16
migrations/0064__add_note_id_to_image_table.sql
Normal file
16
migrations/0064__add_note_id_to_image_table.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
DROP TABLE images;
|
||||
|
||||
CREATE TABLE images
|
||||
(
|
||||
image_id TEXT PRIMARY KEY NOT NULL,
|
||||
note_id TEXT NOT NULL,
|
||||
format TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
data BLOB,
|
||||
is_deleted INT NOT NULL DEFAULT 0,
|
||||
date_modified TEXT NOT NULL,
|
||||
date_created TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX images_note_id_index ON images (note_id);
|
||||
26
migrations/0065__notes_image.sql
Normal file
26
migrations/0065__notes_image.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
DROP TABLE images;
|
||||
|
||||
CREATE TABLE images
|
||||
(
|
||||
image_id TEXT PRIMARY KEY NOT NULL,
|
||||
format TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
data BLOB,
|
||||
is_deleted INT NOT NULL DEFAULT 0,
|
||||
date_modified TEXT NOT NULL,
|
||||
date_created TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE notes_image
|
||||
(
|
||||
note_image_id TEXT PRIMARY KEY NOT NULL,
|
||||
note_id TEXT NOT NULL,
|
||||
image_id TEXT NOT NULL,
|
||||
is_deleted INT NOT NULL DEFAULT 0,
|
||||
date_modified TEXT NOT NULL,
|
||||
date_created TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX notes_image_note_id_index ON notes_image (note_id);
|
||||
CREATE INDEX notes_image_note_id_image_id_index ON notes_image (note_id, image_id);
|
||||
Reference in New Issue
Block a user