mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
note revision sync and other fixes
This commit is contained in:
parent
5c05963bd9
commit
2e58e32112
@ -13,8 +13,8 @@
|
|||||||
<table id="6" parent="2" name="api_tokens"/>
|
<table id="6" parent="2" name="api_tokens"/>
|
||||||
<table id="7" parent="2" name="attributes"/>
|
<table id="7" parent="2" name="attributes"/>
|
||||||
<table id="8" parent="2" name="branches"/>
|
<table id="8" parent="2" name="branches"/>
|
||||||
<table id="9" parent="2" name="event_log"/>
|
<table id="9" parent="2" name="note_contents"/>
|
||||||
<table id="10" parent="2" name="note_contents"/>
|
<table id="10" parent="2" name="note_revision_contents"/>
|
||||||
<table id="11" parent="2" name="note_revisions"/>
|
<table id="11" parent="2" name="note_revisions"/>
|
||||||
<table id="12" parent="2" name="notes"/>
|
<table id="12" parent="2" name="notes"/>
|
||||||
<table id="13" parent="2" name="options"/>
|
<table id="13" parent="2" name="options"/>
|
||||||
@ -57,6 +57,7 @@
|
|||||||
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
|
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>apiTokenId</ColNames>
|
<ColNames>apiTokenId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="25" parent="6">
|
<key id="25" parent="6">
|
||||||
@ -125,20 +126,25 @@
|
|||||||
<index id="37" parent="7" name="sqlite_autoindex_attributes_1">
|
<index id="37" parent="7" name="sqlite_autoindex_attributes_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>attributeId</ColNames>
|
<ColNames>attributeId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="38" parent="7" name="IDX_attributes_noteId_index">
|
<index id="38" parent="7" name="IDX_attributes_noteId_index">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="39" parent="7" name="IDX_attributes_name_value">
|
<index id="39" parent="7" name="IDX_attributes_name_value">
|
||||||
<ColNames>name
|
<ColNames>name
|
||||||
value</ColNames>
|
value</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="40" parent="7" name="IDX_attributes_name_index">
|
<index id="40" parent="7" name="IDX_attributes_name_index">
|
||||||
<ColNames>name</ColNames>
|
<ColNames>name</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="41" parent="7" name="IDX_attributes_value_index">
|
<index id="41" parent="7" name="IDX_attributes_value_index">
|
||||||
<ColNames>value</ColNames>
|
<ColNames>value</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="42" parent="7">
|
<key id="42" parent="7">
|
||||||
<ColNames>attributeId</ColNames>
|
<ColNames>attributeId</ColNames>
|
||||||
@ -171,7 +177,9 @@ value</ColNames>
|
|||||||
</column>
|
</column>
|
||||||
<column id="48" parent="8" name="isExpanded">
|
<column id="48" parent="8" name="isExpanded">
|
||||||
<Position>6</Position>
|
<Position>6</Position>
|
||||||
<DataType>BOOLEAN|0s</DataType>
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="49" parent="8" name="isDeleted">
|
<column id="49" parent="8" name="isDeleted">
|
||||||
<Position>7</Position>
|
<Position>7</Position>
|
||||||
@ -198,52 +206,60 @@ value</ColNames>
|
|||||||
<index id="53" parent="8" name="sqlite_autoindex_branches_1">
|
<index id="53" parent="8" name="sqlite_autoindex_branches_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>branchId</ColNames>
|
<ColNames>branchId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="54" parent="8" name="IDX_branches_noteId_parentNoteId">
|
<index id="54" parent="8" name="IDX_branches_noteId_parentNoteId">
|
||||||
<ColNames>noteId
|
<ColNames>noteId
|
||||||
parentNoteId</ColNames>
|
parentNoteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="55" parent="8" name="IDX_branches_noteId">
|
<index id="55" parent="8" name="IDX_branches_noteId">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="56" parent="8" name="IDX_branches_parentNoteId">
|
<index id="56" parent="8" name="IDX_branches_parentNoteId">
|
||||||
<ColNames>parentNoteId</ColNames>
|
<ColNames>parentNoteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="57" parent="8">
|
<key id="57" parent="8">
|
||||||
<ColNames>branchId</ColNames>
|
<ColNames>branchId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_branches_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_branches_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="58" parent="9" name="eventId">
|
<column id="58" parent="9" name="noteId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="59" parent="9" name="noteId">
|
<column id="59" parent="9" name="content">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<DefaultExpression>NULL</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="60" parent="9" name="comment">
|
<column id="60" parent="9" name="hash">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="61" parent="9" name="utcDateCreated">
|
<column id="61" parent="9" name="utcDateModified">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="62" parent="9" name="sqlite_autoindex_event_log_1">
|
<index id="62" parent="9" name="sqlite_autoindex_note_contents_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>eventId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="63" parent="9">
|
<key id="63" parent="9">
|
||||||
<ColNames>eventId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_event_log_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_note_contents_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="64" parent="10" name="noteId">
|
<column id="64" parent="10" name="noteRevisionId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
@ -251,28 +267,28 @@ parentNoteId</ColNames>
|
|||||||
<column id="65" parent="10" name="content">
|
<column id="65" parent="10" name="content">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<DefaultExpression>NULL</DefaultExpression>
|
|
||||||
</column>
|
</column>
|
||||||
<column id="66" parent="10" name="hash">
|
<column id="66" parent="10" name="hash">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>''</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="67" parent="10" name="utcDateModified">
|
<column id="67" parent="10" name="utcDateModified">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="68" parent="10" name="sqlite_autoindex_note_contents_1">
|
<index id="68" parent="10" name="sqlite_autoindex_note_revision_contents_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="69" parent="10">
|
<key id="69" parent="10">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteRevisionId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_note_contents_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_note_revision_contents_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="70" parent="11" name="noteRevisionId">
|
<column id="70" parent="11" name="noteRevisionId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
@ -288,9 +304,10 @@ parentNoteId</ColNames>
|
|||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="73" parent="11" name="content">
|
<column id="73" parent="11" name="contentLength">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="74" parent="11" name="isProtected">
|
<column id="74" parent="11" name="isProtected">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
@ -298,291 +315,314 @@ parentNoteId</ColNames>
|
|||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="75" parent="11" name="utcDateModifiedFrom">
|
<column id="75" parent="11" name="utcDateLastEdited">
|
||||||
<Position>6</Position>
|
<Position>6</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="76" parent="11" name="utcDateModifiedTo">
|
<column id="76" parent="11" name="utcDateCreated">
|
||||||
<Position>7</Position>
|
<Position>7</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="77" parent="11" name="dateModifiedFrom">
|
<column id="77" parent="11" name="utcDateModified">
|
||||||
<Position>8</Position>
|
<Position>8</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="78" parent="11" name="dateModifiedTo">
|
<column id="78" parent="11" name="dateLastEdited">
|
||||||
<Position>9</Position>
|
<Position>9</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="79" parent="11" name="type">
|
<column id="79" parent="11" name="dateCreated">
|
||||||
<Position>10</Position>
|
<Position>10</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>''</DefaultExpression>
|
|
||||||
</column>
|
</column>
|
||||||
<column id="80" parent="11" name="mime">
|
<column id="80" parent="11" name="type">
|
||||||
<Position>11</Position>
|
<Position>11</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>''</DefaultExpression>
|
<DefaultExpression>''</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="81" parent="11" name="hash">
|
<column id="81" parent="11" name="mime">
|
||||||
<Position>12</Position>
|
<Position>12</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>''</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<index id="82" parent="11" name="sqlite_autoindex_note_revisions_1">
|
<column id="82" parent="11" name="hash">
|
||||||
|
<Position>13</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<index id="83" parent="11" name="sqlite_autoindex_note_revisions_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteRevisionId</ColNames>
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="83" parent="11" name="IDX_note_revisions_noteId">
|
<index id="84" parent="11" name="IDX_note_revisions_noteId">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="84" parent="11" name="IDX_note_revisions_dateModifiedFrom">
|
<index id="85" parent="11" name="IDX_note_revisions_utcDateLastEdited">
|
||||||
<ColNames>utcDateModifiedFrom</ColNames>
|
<ColNames>utcDateLastEdited</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="85" parent="11" name="IDX_note_revisions_dateModifiedTo">
|
<index id="86" parent="11" name="IDX_note_revisions_utcDateCreated">
|
||||||
<ColNames>utcDateModifiedTo</ColNames>
|
<ColNames>utcDateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="86" parent="11">
|
<index id="87" parent="11" name="IDX_note_revisions_dateLastEdited">
|
||||||
|
<ColNames>dateLastEdited</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="88" parent="11" name="IDX_note_revisions_dateCreated">
|
||||||
|
<ColNames>dateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="89" parent="11">
|
||||||
<ColNames>noteRevisionId</ColNames>
|
<ColNames>noteRevisionId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="87" parent="12" name="noteId">
|
<column id="90" parent="12" name="noteId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="88" parent="12" name="title">
|
<column id="91" parent="12" name="title">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>"note"</DefaultExpression>
|
<DefaultExpression>"note"</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="89" parent="12" name="isProtected">
|
<column id="92" parent="12" name="isProtected">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="90" parent="12" name="type">
|
<column id="93" parent="12" name="type">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>'text'</DefaultExpression>
|
<DefaultExpression>'text'</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="91" parent="12" name="mime">
|
<column id="94" parent="12" name="mime">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>'text/html'</DefaultExpression>
|
<DefaultExpression>'text/html'</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="92" parent="12" name="hash">
|
<column id="95" parent="12" name="hash">
|
||||||
<Position>6</Position>
|
<Position>6</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="93" parent="12" name="isDeleted">
|
<column id="96" parent="12" name="isDeleted">
|
||||||
<Position>7</Position>
|
<Position>7</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="94" parent="12" name="dateCreated">
|
<column id="97" parent="12" name="dateCreated">
|
||||||
<Position>8</Position>
|
<Position>8</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="95" parent="12" name="dateModified">
|
<column id="98" parent="12" name="dateModified">
|
||||||
<Position>9</Position>
|
<Position>9</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="96" parent="12" name="utcDateCreated">
|
<column id="99" parent="12" name="utcDateCreated">
|
||||||
<Position>10</Position>
|
<Position>10</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="97" parent="12" name="utcDateModified">
|
<column id="100" parent="12" name="utcDateModified">
|
||||||
<Position>11</Position>
|
<Position>11</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="98" parent="12" name="sqlite_autoindex_notes_1">
|
<index id="101" parent="12" name="sqlite_autoindex_notes_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="99" parent="12">
|
<key id="102" parent="12">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="100" parent="13" name="name">
|
<column id="103" parent="13" name="name">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="101" parent="13" name="value">
|
<column id="104" parent="13" name="value">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="102" parent="13" name="isSynced">
|
<column id="105" parent="13" name="isSynced">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>INTEGER|0s</DataType>
|
<DataType>INTEGER|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="103" parent="13" name="hash">
|
<column id="106" parent="13" name="hash">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="104" parent="13" name="utcDateCreated">
|
<column id="107" parent="13" name="utcDateCreated">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="105" parent="13" name="utcDateModified">
|
<column id="108" parent="13" name="utcDateModified">
|
||||||
<Position>6</Position>
|
<Position>6</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="106" parent="13" name="sqlite_autoindex_options_1">
|
<index id="109" parent="13" name="sqlite_autoindex_options_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>name</ColNames>
|
<ColNames>name</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="107" parent="13">
|
<key id="110" parent="13">
|
||||||
<ColNames>name</ColNames>
|
<ColNames>name</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="108" parent="14" name="noteId">
|
<column id="111" parent="14" name="noteId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="109" parent="14" name="notePath">
|
<column id="112" parent="14" name="notePath">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="110" parent="14" name="hash">
|
<column id="113" parent="14" name="hash">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="111" parent="14" name="utcDateCreated">
|
<column id="114" parent="14" name="utcDateCreated">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="112" parent="14" name="isDeleted">
|
<column id="115" parent="14" name="isDeleted">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<index id="113" parent="14" name="sqlite_autoindex_recent_notes_1">
|
<index id="116" parent="14" name="sqlite_autoindex_recent_notes_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="114" parent="14">
|
<key id="117" parent="14">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="115" parent="15" name="sourceId">
|
<column id="118" parent="15" name="sourceId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="116" parent="15" name="utcDateCreated">
|
<column id="119" parent="15" name="utcDateCreated">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="117" parent="15" name="sqlite_autoindex_source_ids_1">
|
<index id="120" parent="15" name="sqlite_autoindex_source_ids_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>sourceId</ColNames>
|
<ColNames>sourceId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="118" parent="15">
|
<key id="121" parent="15">
|
||||||
<ColNames>sourceId</ColNames>
|
<ColNames>sourceId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="119" parent="16" name="type">
|
<column id="122" parent="16" name="type">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="120" parent="16" name="name">
|
<column id="123" parent="16" name="name">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="121" parent="16" name="tbl_name">
|
<column id="124" parent="16" name="tbl_name">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="122" parent="16" name="rootpage">
|
<column id="125" parent="16" name="rootpage">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>int|0s</DataType>
|
<DataType>int|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="123" parent="16" name="sql">
|
<column id="126" parent="16" name="sql">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="124" parent="17" name="name">
|
<column id="127" parent="17" name="name">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
</column>
|
</column>
|
||||||
<column id="125" parent="17" name="seq">
|
<column id="128" parent="17" name="seq">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
</column>
|
</column>
|
||||||
<column id="126" parent="18" name="id">
|
<column id="129" parent="18" name="id">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>INTEGER|0s</DataType>
|
<DataType>INTEGER|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<SequenceIdentity>1</SequenceIdentity>
|
<SequenceIdentity>1</SequenceIdentity>
|
||||||
</column>
|
</column>
|
||||||
<column id="127" parent="18" name="entityName">
|
<column id="130" parent="18" name="entityName">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="128" parent="18" name="entityId">
|
<column id="131" parent="18" name="entityId">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="129" parent="18" name="sourceId">
|
<column id="132" parent="18" name="sourceId">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="130" parent="18" name="utcSyncDate">
|
<column id="133" parent="18" name="utcSyncDate">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="131" parent="18" name="IDX_sync_entityName_entityId">
|
<index id="134" parent="18" name="IDX_sync_entityName_entityId">
|
||||||
<ColNames>entityName
|
<ColNames>entityName
|
||||||
entityId</ColNames>
|
entityId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="132" parent="18" name="IDX_sync_utcSyncDate">
|
<index id="135" parent="18" name="IDX_sync_utcSyncDate">
|
||||||
<ColNames>utcSyncDate</ColNames>
|
<ColNames>utcSyncDate</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="133" parent="18">
|
<key id="136" parent="18">
|
||||||
<ColNames>id</ColNames>
|
<ColNames>id</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
</key>
|
</key>
|
||||||
|
@ -31,3 +31,6 @@ CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCr
|
|||||||
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
|
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
|
||||||
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
|
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
|
||||||
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
|
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
|
||||||
|
|
||||||
|
INSERT INTO sync (entityName, entityId, sourceId, utcSyncDate)
|
||||||
|
SELECT 'note_revision_contents', entityId, sourceId, utcSyncDate FROM sync WHERE entityName = 'note_revisions';
|
@ -9,19 +9,6 @@ CREATE TABLE IF NOT EXISTS "source_ids" (
|
|||||||
`utcDateCreated` TEXT NOT NULL,
|
`utcDateCreated` TEXT NOT NULL,
|
||||||
PRIMARY KEY(`sourceId`)
|
PRIMARY KEY(`sourceId`)
|
||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS "note_revisions" (
|
|
||||||
`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
|
|
||||||
`noteId` TEXT NOT NULL,
|
|
||||||
`title` TEXT,
|
|
||||||
`content` TEXT,
|
|
||||||
`isProtected` INT NOT NULL DEFAULT 0,
|
|
||||||
`utcDateModifiedFrom` TEXT NOT NULL,
|
|
||||||
`utcDateModifiedTo` TEXT NOT NULL,
|
|
||||||
`dateModifiedFrom` TEXT NOT NULL,
|
|
||||||
`dateModifiedTo` TEXT NOT NULL,
|
|
||||||
type TEXT DEFAULT '' NOT NULL,
|
|
||||||
mime TEXT DEFAULT '' NOT NULL,
|
|
||||||
hash TEXT DEFAULT "" NOT NULL);
|
|
||||||
CREATE TABLE IF NOT EXISTS "api_tokens"
|
CREATE TABLE IF NOT EXISTS "api_tokens"
|
||||||
(
|
(
|
||||||
apiTokenId TEXT PRIMARY KEY NOT NULL,
|
apiTokenId TEXT PRIMARY KEY NOT NULL,
|
||||||
@ -72,15 +59,6 @@ CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
|
|||||||
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
|
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
|
||||||
`utcSyncDate`
|
`utcSyncDate`
|
||||||
);
|
);
|
||||||
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (
|
|
||||||
`noteId`
|
|
||||||
);
|
|
||||||
CREATE INDEX `IDX_note_revisions_dateModifiedFrom` ON `note_revisions` (
|
|
||||||
`utcDateModifiedFrom`
|
|
||||||
);
|
|
||||||
CREATE INDEX `IDX_note_revisions_dateModifiedTo` ON `note_revisions` (
|
|
||||||
`utcDateModifiedTo`
|
|
||||||
);
|
|
||||||
CREATE INDEX IDX_attributes_name_value
|
CREATE INDEX IDX_attributes_name_value
|
||||||
on attributes (name, value);
|
on attributes (name, value);
|
||||||
CREATE INDEX IDX_attributes_name_index
|
CREATE INDEX IDX_attributes_name_index
|
||||||
@ -119,3 +97,25 @@ CREATE TABLE IF NOT EXISTS "branches" (
|
|||||||
CREATE INDEX `IDX_branches_noteId` ON `branches` (`noteId`);
|
CREATE INDEX `IDX_branches_noteId` ON `branches` (`noteId`);
|
||||||
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
|
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
|
||||||
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
|
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
|
||||||
|
CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
|
||||||
|
`noteId` TEXT NOT NULL,
|
||||||
|
`title` TEXT,
|
||||||
|
`contentLength` INT NOT NULL,
|
||||||
|
`isProtected` INT NOT NULL DEFAULT 0,
|
||||||
|
`utcDateLastEdited` TEXT NOT NULL,
|
||||||
|
`utcDateCreated` TEXT NOT NULL,
|
||||||
|
`utcDateModified` TEXT NOT NULL,
|
||||||
|
`dateLastEdited` TEXT NOT NULL,
|
||||||
|
`dateCreated` TEXT NOT NULL,
|
||||||
|
type TEXT DEFAULT '' NOT NULL,
|
||||||
|
mime TEXT DEFAULT '' NOT NULL,
|
||||||
|
hash TEXT DEFAULT '' NOT NULL);
|
||||||
|
CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
|
||||||
|
`content` TEXT,
|
||||||
|
hash TEXT DEFAULT '' NOT NULL,
|
||||||
|
`utcDateModified` TEXT NOT NULL);
|
||||||
|
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`);
|
||||||
|
CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`);
|
||||||
|
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
|
||||||
|
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
|
||||||
|
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
|
||||||
|
@ -125,7 +125,7 @@ class NoteRevision extends Entity {
|
|||||||
|
|
||||||
await sql.upsert("note_revision_contents", "noteRevisionId", pojo);
|
await sql.upsert("note_revision_contents", "noteRevisionId", pojo);
|
||||||
|
|
||||||
await syncTableService.addNoteContentSync(this.noteId);
|
await syncTableService.addNoteRevisionContentSync(this.noteRevisionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot be static!
|
// cannot be static!
|
||||||
|
@ -19,7 +19,9 @@ function setupElementTooltip($el) {
|
|||||||
async function mouseEnterHandler() {
|
async function mouseEnterHandler() {
|
||||||
const $link = $(this);
|
const $link = $(this);
|
||||||
|
|
||||||
if ($link.hasClass("no-tooltip-preview") || $link.hasClass("disabled")) {
|
if ($link.hasClass("no-tooltip-preview")
|
||||||
|
|| $link.hasClass("disabled")
|
||||||
|
|| $link.attr("data-action") === 'note-revision') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ async function getNoteRevisions(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getNoteRevision(req) {
|
async function getNoteRevision(req) {
|
||||||
const {noteRevisionId} = req.params;
|
const noteRevision = await repository.getNoteRevision(req.params.noteRevisionId);
|
||||||
|
|
||||||
return await repository.getNote(`SELECT *
|
await noteRevision.getContent();
|
||||||
FROM note_revisions
|
|
||||||
WHERE noteRevisionId = ?`, [noteId]);
|
return noteRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getEditedNotesOnDate(req) {
|
async function getEditedNotesOnDate(req) {
|
||||||
|
@ -141,6 +141,7 @@ module.exports = {
|
|||||||
getEntity,
|
getEntity,
|
||||||
getNote,
|
getNote,
|
||||||
getNotes,
|
getNotes,
|
||||||
|
getNoteRevision,
|
||||||
getBranch,
|
getBranch,
|
||||||
getAttribute,
|
getAttribute,
|
||||||
getOption,
|
getOption,
|
||||||
|
@ -64,6 +64,7 @@ async function fillAllSyncRows() {
|
|||||||
await fillSyncRows("note_contents", "noteId");
|
await fillSyncRows("note_contents", "noteId");
|
||||||
await fillSyncRows("branches", "branchId");
|
await fillSyncRows("branches", "branchId");
|
||||||
await fillSyncRows("note_revisions", "noteRevisionId");
|
await fillSyncRows("note_revisions", "noteRevisionId");
|
||||||
|
await fillSyncRows("note_revision_contents", "noteRevisionId");
|
||||||
await fillSyncRows("recent_notes", "noteId");
|
await fillSyncRows("recent_notes", "noteId");
|
||||||
await fillSyncRows("attributes", "attributeId");
|
await fillSyncRows("attributes", "attributeId");
|
||||||
await fillSyncRows("api_tokens", "apiTokenId");
|
await fillSyncRows("api_tokens", "apiTokenId");
|
||||||
@ -76,6 +77,7 @@ module.exports = {
|
|||||||
addBranchSync: async (branchId, sourceId) => await addEntitySync("branches", branchId, sourceId),
|
addBranchSync: async (branchId, sourceId) => await addEntitySync("branches", branchId, sourceId),
|
||||||
addNoteReorderingSync: async (parentNoteId, sourceId) => await addEntitySync("note_reordering", parentNoteId, sourceId),
|
addNoteReorderingSync: async (parentNoteId, sourceId) => await addEntitySync("note_reordering", parentNoteId, sourceId),
|
||||||
addNoteRevisionSync: async (noteRevisionId, sourceId) => await addEntitySync("note_revisions", noteRevisionId, sourceId),
|
addNoteRevisionSync: async (noteRevisionId, sourceId) => await addEntitySync("note_revisions", noteRevisionId, sourceId),
|
||||||
|
addNoteRevisionContentSync: async (noteRevisionId, sourceId) => await addEntitySync("note_revision_contents", noteRevisionId, sourceId),
|
||||||
addOptionsSync: async (name, sourceId) => await addEntitySync("options", name, sourceId),
|
addOptionsSync: async (name, sourceId) => await addEntitySync("options", name, sourceId),
|
||||||
addRecentNoteSync: async (noteId, sourceId) => await addEntitySync("recent_notes", noteId, sourceId),
|
addRecentNoteSync: async (noteId, sourceId) => await addEntitySync("recent_notes", noteId, sourceId),
|
||||||
addAttributeSync: async (attributeId, sourceId) => await addEntitySync("attributes", attributeId, sourceId),
|
addAttributeSync: async (attributeId, sourceId) => await addEntitySync("attributes", attributeId, sourceId),
|
||||||
|
@ -39,7 +39,7 @@ async function updateEntity(sync, entity, sourceId) {
|
|||||||
|
|
||||||
// currently making exception for protected notes and note revisions because here
|
// currently making exception for protected notes and note revisions because here
|
||||||
// the title and content are not available decrypted as listeners would expect
|
// the title and content are not available decrypted as listeners would expect
|
||||||
if ((entityName !== 'notes' && entityName !== 'note_revisions') || !entity.isProtected) {
|
if (!['notes', 'note_contents', 'note_revisions', 'note_revision_contents'].includes(entityName) || !entity.isProtected) {
|
||||||
await eventService.emit(eventService.ENTITY_SYNCED, {
|
await eventService.emit(eventService.ENTITY_SYNCED, {
|
||||||
entityName,
|
entityName,
|
||||||
entity
|
entity
|
||||||
@ -101,11 +101,7 @@ async function updateNoteRevision(entity, sourceId) {
|
|||||||
const orig = await sql.getRowOrNull("SELECT * FROM note_revisions WHERE noteRevisionId = ?", [entity.noteRevisionId]);
|
const orig = await sql.getRowOrNull("SELECT * FROM note_revisions WHERE noteRevisionId = ?", [entity.noteRevisionId]);
|
||||||
|
|
||||||
await sql.transactional(async () => {
|
await sql.transactional(async () => {
|
||||||
// we update note revision even if date modified to is the same because the only thing which might have changed
|
if (orig === null || orig.utcDateModified < entity.utcDateModified) {
|
||||||
// is the protected status (and correnspondingly title and content) which doesn't affect the utcDateCreated
|
|
||||||
if (orig === null || orig.utcDateCreated <= entity.utcDateCreated) {
|
|
||||||
entity.content = entity.content === null ? null : Buffer.from(entity.content, 'base64');
|
|
||||||
|
|
||||||
await sql.replace('note_revisions', entity);
|
await sql.replace('note_revisions', entity);
|
||||||
|
|
||||||
await syncTableService.addNoteRevisionSync(entity.noteRevisionId, sourceId);
|
await syncTableService.addNoteRevisionSync(entity.noteRevisionId, sourceId);
|
||||||
@ -115,6 +111,22 @@ async function updateNoteRevision(entity, sourceId) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateNoteRevisionContent(entity, sourceId) {
|
||||||
|
const orig = await sql.getRowOrNull("SELECT * FROM note_revision_contents WHERE noteRevisionId = ?", [entity.noteRevisionId]);
|
||||||
|
|
||||||
|
await sql.transactional(async () => {
|
||||||
|
if (orig === null || orig.utcDateModified < entity.utcDateModified) {
|
||||||
|
entity.content = entity.content === null ? null : Buffer.from(entity.content, 'base64');
|
||||||
|
|
||||||
|
await sql.replace('note_revision_contents', entity);
|
||||||
|
|
||||||
|
await syncTableService.addNoteRevisionContentSync(entity.noteRevisionId, sourceId);
|
||||||
|
|
||||||
|
log.info("Update/sync note revision content " + entity.noteRevisionId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function updateNoteReordering(entityId, entity, sourceId) {
|
async function updateNoteReordering(entityId, entity, sourceId) {
|
||||||
await sql.transactional(async () => {
|
await sql.transactional(async () => {
|
||||||
for (const key in entity) {
|
for (const key in entity) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user