mirror of
https://github.com/zadam/trilium.git
synced 2024-11-11 18:08:13 +08:00
28 lines
1 KiB
MySQL
28 lines
1 KiB
MySQL
|
create table attributes
|
||
|
(
|
||
|
attributeId TEXT not null primary key,
|
||
|
noteId TEXT not null,
|
||
|
type TEXT not null,
|
||
|
name TEXT not null,
|
||
|
value TEXT default '' not null,
|
||
|
position INT default 0 not null,
|
||
|
dateCreated TEXT not null,
|
||
|
dateModified TEXT not null,
|
||
|
isDeleted INT not null,
|
||
|
hash TEXT default "" not null);
|
||
|
|
||
|
create index IDX_attributes_name_value
|
||
|
on labels (name, value);
|
||
|
|
||
|
create index IDX_attributes_value
|
||
|
on labels (value);
|
||
|
|
||
|
create index IDX_attributes_noteId
|
||
|
on labels (noteId);
|
||
|
|
||
|
INSERT INTO attributes (attributeId, noteId, type, name, value, position, dateCreated, dateModified, isDeleted, hash)
|
||
|
SELECT labelId, noteId, 'label', name, value, position, dateCreated, dateModified, isDeleted, hash FROM labels;
|
||
|
|
||
|
INSERT INTO attributes (attributeId, noteId, type, name, value, position, dateCreated, dateModified, isDeleted, hash)
|
||
|
SELECT relationId, sourceNoteId, 'relation', name, targetNoteId, position, dateCreated, dateModified, isDeleted, hash FROM relations;
|