mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
note content refactoring, WIP
This commit is contained in:
parent
6952b643ae
commit
4a093000be
@ -131,562 +131,535 @@
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="39" parent="7" name="IDX_attributes_noteId">
|
||||
<index id="39" parent="7" name="IDX_attributes_noteId_index">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="40" parent="7" name="IDX_attributes_noteId_index">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="41" parent="7" name="IDX_attributes_name_value">
|
||||
<index id="40" parent="7" name="IDX_attributes_name_value">
|
||||
<ColNames>name
|
||||
value</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="42" parent="7" name="IDX_attributes_name">
|
||||
<index id="41" parent="7" name="IDX_attributes_name_index">
|
||||
<ColNames>name</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="43" parent="7" name="IDX_attributes_name_index">
|
||||
<ColNames>name</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="44" parent="7" name="IDX_attributes_value">
|
||||
<index id="42" parent="7" name="IDX_attributes_value_index">
|
||||
<ColNames>value</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="45" parent="7" name="IDX_attributes_value_index">
|
||||
<ColNames>value</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="46" parent="7">
|
||||
<key id="43" parent="7">
|
||||
<ColNames>attributeId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_attributes_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="47" parent="8" name="branchId">
|
||||
<column id="44" parent="8" name="branchId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="48" parent="8" name="noteId">
|
||||
<column id="45" parent="8" name="noteId">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="49" parent="8" name="parentNoteId">
|
||||
<column id="46" parent="8" name="parentNoteId">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="50" parent="8" name="notePosition">
|
||||
<column id="47" parent="8" name="notePosition">
|
||||
<Position>4</Position>
|
||||
<DataType>INTEGER|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="51" parent="8" name="prefix">
|
||||
<column id="48" parent="8" name="prefix">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="52" parent="8" name="isExpanded">
|
||||
<column id="49" parent="8" name="isExpanded">
|
||||
<Position>6</Position>
|
||||
<DataType>BOOLEAN|0s</DataType>
|
||||
</column>
|
||||
<column id="53" parent="8" name="isDeleted">
|
||||
<column id="50" parent="8" name="isDeleted">
|
||||
<Position>7</Position>
|
||||
<DataType>INTEGER|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="54" parent="8" name="dateModified">
|
||||
<column id="51" parent="8" name="dateModified">
|
||||
<Position>8</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="55" parent="8" name="hash">
|
||||
<column id="52" parent="8" name="hash">
|
||||
<Position>9</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<column id="56" parent="8" name="dateCreated">
|
||||
<column id="53" parent="8" name="dateCreated">
|
||||
<Position>10</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>'1970-01-01T00:00:00.000Z'</DefaultExpression>
|
||||
</column>
|
||||
<index id="57" parent="8" name="sqlite_autoindex_branches_1">
|
||||
<index id="54" parent="8" name="sqlite_autoindex_branches_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>branchId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="58" parent="8" name="IDX_branches_noteId_parentNoteId">
|
||||
<index id="55" parent="8" name="IDX_branches_noteId_parentNoteId">
|
||||
<ColNames>noteId
|
||||
parentNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="59" parent="8" name="IDX_branches_noteId">
|
||||
<index id="56" parent="8" name="IDX_branches_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="60" parent="8" name="IDX_branches_parentNoteId">
|
||||
<index id="57" parent="8" name="IDX_branches_parentNoteId">
|
||||
<ColNames>parentNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="61" parent="8">
|
||||
<key id="58" parent="8">
|
||||
<ColNames>branchId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_branches_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="62" parent="9" name="eventId">
|
||||
<column id="59" parent="9" name="eventId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="63" parent="9" name="noteId">
|
||||
<column id="60" parent="9" name="noteId">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="64" parent="9" name="comment">
|
||||
<column id="61" parent="9" name="comment">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="65" parent="9" name="dateCreated">
|
||||
<column id="62" parent="9" name="dateCreated">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<index id="66" parent="9" name="sqlite_autoindex_event_log_1">
|
||||
<index id="63" parent="9" name="sqlite_autoindex_event_log_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>eventId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="67" parent="9" name="IDX_event_log_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="68" parent="9">
|
||||
<key id="64" parent="9">
|
||||
<ColNames>eventId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_event_log_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="69" parent="10" name="linkId">
|
||||
<column id="65" parent="10" name="linkId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="70" parent="10" name="noteId">
|
||||
<column id="66" parent="10" name="noteId">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="71" parent="10" name="targetNoteId">
|
||||
<column id="67" parent="10" name="targetNoteId">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="72" parent="10" name="type">
|
||||
<column id="68" parent="10" name="type">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="73" parent="10" name="hash">
|
||||
<column id="69" parent="10" name="hash">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<column id="74" parent="10" name="isDeleted">
|
||||
<column id="70" parent="10" name="isDeleted">
|
||||
<Position>6</Position>
|
||||
<DataType>INTEGER|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="75" parent="10" name="dateCreated">
|
||||
<column id="71" parent="10" name="dateCreated">
|
||||
<Position>7</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="76" parent="10" name="dateModified">
|
||||
<column id="72" parent="10" name="dateModified">
|
||||
<Position>8</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<index id="77" parent="10" name="sqlite_autoindex_links_1">
|
||||
<index id="73" parent="10" name="sqlite_autoindex_links_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>linkId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="78" parent="10" name="IDX_links_noteId">
|
||||
<index id="74" parent="10" name="IDX_links_noteId_index">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="79" parent="10" name="IDX_links_noteId_index">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="80" parent="10" name="IDX_links_targetNoteId">
|
||||
<index id="75" parent="10" name="IDX_links_targetNoteId_index">
|
||||
<ColNames>targetNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="81" parent="10" name="IDX_links_targetNoteId_index">
|
||||
<ColNames>targetNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="82" parent="10">
|
||||
<key id="76" parent="10">
|
||||
<ColNames>linkId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_links_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="83" parent="11" name="noteContentId">
|
||||
<column id="77" parent="11" name="noteContentId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="84" parent="11" name="noteId">
|
||||
<column id="78" parent="11" name="noteId">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="85" parent="11" name="isProtected">
|
||||
<column id="79" parent="11" name="isProtected">
|
||||
<Position>3</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="86" parent="11" name="content">
|
||||
<column id="80" parent="11" name="content">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<DefaultExpression>NULL</DefaultExpression>
|
||||
</column>
|
||||
<column id="87" parent="11" name="hash">
|
||||
<column id="81" parent="11" name="hash">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<index id="88" parent="11" name="sqlite_autoindex_note_contents_1">
|
||||
<index id="82" parent="11" name="sqlite_autoindex_note_contents_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteContentId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="89" parent="11" name="IDX_note_contents_noteId">
|
||||
<index id="83" parent="11" name="IDX_note_contents_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="90" parent="11">
|
||||
<key id="84" parent="11">
|
||||
<ColNames>noteContentId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_note_contents_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="91" parent="12" name="noteRevisionId">
|
||||
<column id="85" parent="12" name="noteRevisionId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="92" parent="12" name="noteId">
|
||||
<column id="86" parent="12" name="noteId">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="93" parent="12" name="title">
|
||||
<column id="87" parent="12" name="title">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="94" parent="12" name="content">
|
||||
<column id="88" parent="12" name="content">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="95" parent="12" name="isProtected">
|
||||
<column id="89" parent="12" name="isProtected">
|
||||
<Position>5</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="96" parent="12" name="dateModifiedFrom">
|
||||
<column id="90" parent="12" name="dateModifiedFrom">
|
||||
<Position>6</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="97" parent="12" name="dateModifiedTo">
|
||||
<column id="91" parent="12" name="dateModifiedTo">
|
||||
<Position>7</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="98" parent="12" name="type">
|
||||
<column id="92" parent="12" name="type">
|
||||
<Position>8</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>''</DefaultExpression>
|
||||
</column>
|
||||
<column id="99" parent="12" name="mime">
|
||||
<column id="93" parent="12" name="mime">
|
||||
<Position>9</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>''</DefaultExpression>
|
||||
</column>
|
||||
<column id="100" parent="12" name="hash">
|
||||
<column id="94" parent="12" name="hash">
|
||||
<Position>10</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<index id="101" parent="12" name="sqlite_autoindex_note_revisions_1">
|
||||
<index id="95" parent="12" name="sqlite_autoindex_note_revisions_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteRevisionId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="102" parent="12" name="IDX_note_revisions_noteId">
|
||||
<index id="96" parent="12" name="IDX_note_revisions_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="103" parent="12" name="IDX_note_revisions_dateModifiedFrom">
|
||||
<index id="97" parent="12" name="IDX_note_revisions_dateModifiedFrom">
|
||||
<ColNames>dateModifiedFrom</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="104" parent="12" name="IDX_note_revisions_dateModifiedTo">
|
||||
<index id="98" parent="12" name="IDX_note_revisions_dateModifiedTo">
|
||||
<ColNames>dateModifiedTo</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="105" parent="12">
|
||||
<key id="99" parent="12">
|
||||
<ColNames>noteRevisionId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="106" parent="13" name="noteId">
|
||||
<column id="100" parent="13" name="noteId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="107" parent="13" name="title">
|
||||
<column id="101" parent="13" name="title">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>"note"</DefaultExpression>
|
||||
</column>
|
||||
<column id="108" parent="13" name="isProtected">
|
||||
<column id="102" parent="13" name="isProtected">
|
||||
<Position>3</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="109" parent="13" name="type">
|
||||
<column id="103" parent="13" name="type">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>'text'</DefaultExpression>
|
||||
</column>
|
||||
<column id="110" parent="13" name="mime">
|
||||
<column id="104" parent="13" name="mime">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>'text/html'</DefaultExpression>
|
||||
</column>
|
||||
<column id="111" parent="13" name="hash">
|
||||
<column id="105" parent="13" name="hash">
|
||||
<Position>6</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<column id="112" parent="13" name="isDeleted">
|
||||
<column id="106" parent="13" name="isDeleted">
|
||||
<Position>7</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="113" parent="13" name="dateCreated">
|
||||
<column id="107" parent="13" name="dateCreated">
|
||||
<Position>8</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="114" parent="13" name="dateModified">
|
||||
<column id="108" parent="13" name="dateModified">
|
||||
<Position>9</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<index id="115" parent="13" name="sqlite_autoindex_notes_1">
|
||||
<index id="109" parent="13" name="sqlite_autoindex_notes_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="116" parent="13" name="IDX_notes_isDeleted">
|
||||
<ColNames>isDeleted</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="117" parent="13">
|
||||
<key id="110" parent="13">
|
||||
<ColNames>noteId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="118" parent="14" name="name">
|
||||
<column id="111" parent="14" name="name">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="119" parent="14" name="value">
|
||||
<column id="112" parent="14" name="value">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
</column>
|
||||
<column id="120" parent="14" name="dateModified">
|
||||
<column id="113" parent="14" name="dateModified">
|
||||
<Position>3</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
</column>
|
||||
<column id="121" parent="14" name="isSynced">
|
||||
<column id="114" parent="14" name="isSynced">
|
||||
<Position>4</Position>
|
||||
<DataType>INTEGER|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>0</DefaultExpression>
|
||||
</column>
|
||||
<column id="122" parent="14" name="hash">
|
||||
<column id="115" parent="14" name="hash">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<column id="123" parent="14" name="dateCreated">
|
||||
<column id="116" parent="14" name="dateCreated">
|
||||
<Position>6</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>'1970-01-01T00:00:00.000Z'</DefaultExpression>
|
||||
</column>
|
||||
<index id="124" parent="14" name="sqlite_autoindex_options_1">
|
||||
<index id="117" parent="14" name="sqlite_autoindex_options_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>name</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="125" parent="14">
|
||||
<key id="118" parent="14">
|
||||
<ColNames>name</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="126" parent="15" name="branchId">
|
||||
<column id="119" parent="15" name="branchId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="127" parent="15" name="notePath">
|
||||
<column id="120" parent="15" name="notePath">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="128" parent="15" name="hash">
|
||||
<column id="121" parent="15" name="hash">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<DefaultExpression>""</DefaultExpression>
|
||||
</column>
|
||||
<column id="129" parent="15" name="dateCreated">
|
||||
<column id="122" parent="15" name="dateCreated">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="130" parent="15" name="isDeleted">
|
||||
<column id="123" parent="15" name="isDeleted">
|
||||
<Position>5</Position>
|
||||
<DataType>INT|0s</DataType>
|
||||
</column>
|
||||
<index id="131" parent="15" name="sqlite_autoindex_recent_notes_1">
|
||||
<index id="124" parent="15" name="sqlite_autoindex_recent_notes_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>branchId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="132" parent="15">
|
||||
<key id="125" parent="15">
|
||||
<ColNames>branchId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="133" parent="16" name="sourceId">
|
||||
<column id="126" parent="16" name="sourceId">
|
||||
<Position>1</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="134" parent="16" name="dateCreated">
|
||||
<column id="127" parent="16" name="dateCreated">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<index id="135" parent="16" name="sqlite_autoindex_source_ids_1">
|
||||
<index id="128" parent="16" name="sqlite_autoindex_source_ids_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>sourceId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="136" parent="16">
|
||||
<key id="129" parent="16">
|
||||
<ColNames>sourceId</ColNames>
|
||||
<Primary>1</Primary>
|
||||
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
||||
</key>
|
||||
<column id="137" parent="17" name="type">
|
||||
<column id="130" parent="17" name="type">
|
||||
<Position>1</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
</column>
|
||||
<column id="138" parent="17" name="name">
|
||||
<column id="131" parent="17" name="name">
|
||||
<Position>2</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
</column>
|
||||
<column id="139" parent="17" name="tbl_name">
|
||||
<column id="132" parent="17" name="tbl_name">
|
||||
<Position>3</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
</column>
|
||||
<column id="140" parent="17" name="rootpage">
|
||||
<column id="133" parent="17" name="rootpage">
|
||||
<Position>4</Position>
|
||||
<DataType>integer|0s</DataType>
|
||||
</column>
|
||||
<column id="141" parent="17" name="sql">
|
||||
<column id="134" parent="17" name="sql">
|
||||
<Position>5</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
</column>
|
||||
<column id="142" parent="18" name="name">
|
||||
<column id="135" parent="18" name="name">
|
||||
<Position>1</Position>
|
||||
</column>
|
||||
<column id="143" parent="18" name="seq">
|
||||
<column id="136" parent="18" name="seq">
|
||||
<Position>2</Position>
|
||||
</column>
|
||||
<column id="144" parent="19" name="id">
|
||||
<column id="137" parent="19" name="id">
|
||||
<Position>1</Position>
|
||||
<DataType>INTEGER|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
<SequenceIdentity>1</SequenceIdentity>
|
||||
</column>
|
||||
<column id="145" parent="19" name="entityName">
|
||||
<column id="138" parent="19" name="entityName">
|
||||
<Position>2</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="146" parent="19" name="entityId">
|
||||
<column id="139" parent="19" name="entityId">
|
||||
<Position>3</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="147" parent="19" name="sourceId">
|
||||
<column id="140" parent="19" name="sourceId">
|
||||
<Position>4</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<column id="148" parent="19" name="syncDate">
|
||||
<column id="141" parent="19" name="syncDate">
|
||||
<Position>5</Position>
|
||||
<DataType>TEXT|0s</DataType>
|
||||
<NotNull>1</NotNull>
|
||||
</column>
|
||||
<index id="149" parent="19" name="IDX_sync_entityName_entityId">
|
||||
<index id="142" parent="19" name="IDX_sync_entityName_entityId">
|
||||
<ColNames>entityName
|
||||
entityId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="150" parent="19" name="IDX_sync_syncDate">
|
||||
<index id="143" parent="19" name="IDX_sync_syncDate">
|
||||
<ColNames>syncDate</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="151" parent="19">
|
||||
<key id="144" parent="19">
|
||||
<ColNames>id</ColNames>
|
||||
<Primary>1</Primary>
|
||||
</key>
|
||||
|
@ -31,5 +31,3 @@ SELECT noteId, title, isProtected, isDeleted, dateCreated, dateModified, type, m
|
||||
DROP TABLE notes;
|
||||
|
||||
ALTER TABLE notes_mig RENAME TO notes;
|
||||
|
||||
CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`);
|
@ -1,8 +0,0 @@
|
||||
CREATE INDEX `IDX_attributes_noteId` ON `attributes` (`noteId`);
|
||||
CREATE INDEX `IDX_attributes_name` ON `attributes` (`name`);
|
||||
CREATE INDEX `IDX_attributes_value` ON `attributes` (`value`);
|
||||
|
||||
CREATE INDEX `IDX_event_log_noteId` ON `event_log` (`noteId`);
|
||||
|
||||
CREATE INDEX `IDX_links_noteId` ON `links` (`noteId`);
|
||||
CREATE INDEX `IDX_links_targetNoteId` ON `links` (`targetNoteId`);
|
@ -8,7 +8,10 @@ class Entity {
|
||||
*/
|
||||
constructor(row = {}) {
|
||||
for (const key in row) {
|
||||
this[key] = row[key];
|
||||
// ! is used when joint-fetching notes and note_contents objects for performance
|
||||
if (!key.startsWith('!')) {
|
||||
this[key] = row[key];
|
||||
}
|
||||
}
|
||||
|
||||
if ('isDeleted' in this) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
const Entity = require('./entity');
|
||||
const Attribute = require('./attribute');
|
||||
const NoteContent = require('./note_content');
|
||||
const protectedSessionService = require('../services/protected_session');
|
||||
const repository = require('../services/repository');
|
||||
const sql = require('../services/sql');
|
||||
@ -62,6 +63,10 @@ class Note extends Entity {
|
||||
async getNoteContent() {
|
||||
if (!this.noteContent) {
|
||||
this.noteContent = await repository.getEntity(`SELECT * FROM note_contents WHERE noteId = ?`, [this.noteId]);
|
||||
|
||||
if (!this.noteContent) {
|
||||
throw new Error("Note content not found for noteId=" + this.noteId);
|
||||
}
|
||||
}
|
||||
|
||||
return this.noteContent;
|
||||
@ -81,6 +86,23 @@ class Note extends Entity {
|
||||
return JSON.parse(content);
|
||||
}
|
||||
|
||||
/** @returns {Promise} */
|
||||
async setContent(content) {
|
||||
if (!this.noteContent) {
|
||||
// make sure it is loaded
|
||||
await this.getNoteContent();
|
||||
}
|
||||
|
||||
this.noteContent.content = content;
|
||||
|
||||
await this.noteContent.save();
|
||||
}
|
||||
|
||||
/** @returns {Promise} */
|
||||
async setJsonContent(content) {
|
||||
await this.setContent(JSON.stringify(content));
|
||||
}
|
||||
|
||||
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
|
||||
isRoot() {
|
||||
return this.noteId === 'root';
|
||||
@ -620,9 +642,6 @@ class Note extends Entity {
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
// we do this here because encryption needs the note ID for the IV
|
||||
this.generateIdIfNecessary();
|
||||
|
||||
if (!this.isDeleted) {
|
||||
this.isDeleted = false;
|
||||
}
|
||||
|
@ -100,6 +100,5 @@ module.exports = {
|
||||
getNoteWithLabel,
|
||||
createLabel,
|
||||
createAttribute,
|
||||
getAttributeNames,
|
||||
BUILTIN_ATTRIBUTES
|
||||
getAttributeNames
|
||||
};
|
@ -96,7 +96,7 @@ async function createNewNote(parentNoteId, noteData) {
|
||||
note.noteContent = await new NoteContent({
|
||||
noteId: note.noteId,
|
||||
content: noteData.content
|
||||
});
|
||||
}).save();
|
||||
|
||||
const branch = await new Branch({
|
||||
noteId: note.noteId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user