mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
set sync.isSynced correctly
This commit is contained in:
parent
c67613a557
commit
eb287917c1
@ -10,5 +10,683 @@
|
|||||||
<collation id="3" parent="1" name="BINARY"/>
|
<collation id="3" parent="1" name="BINARY"/>
|
||||||
<collation id="4" parent="1" name="NOCASE"/>
|
<collation id="4" parent="1" name="NOCASE"/>
|
||||||
<collation id="5" parent="1" name="RTRIM"/>
|
<collation id="5" parent="1" name="RTRIM"/>
|
||||||
|
<table id="6" parent="2" name="api_tokens"/>
|
||||||
|
<table id="7" parent="2" name="attributes"/>
|
||||||
|
<table id="8" parent="2" name="branches"/>
|
||||||
|
<table id="9" parent="2" name="note_contents"/>
|
||||||
|
<table id="10" parent="2" name="note_revision_contents"/>
|
||||||
|
<table id="11" parent="2" name="note_revisions"/>
|
||||||
|
<table id="12" parent="2" name="notes"/>
|
||||||
|
<table id="13" parent="2" name="options"/>
|
||||||
|
<table id="14" parent="2" name="recent_notes"/>
|
||||||
|
<table id="15" parent="2" name="source_ids"/>
|
||||||
|
<table id="16" parent="2" name="sqlite_master">
|
||||||
|
<System>1</System>
|
||||||
|
</table>
|
||||||
|
<table id="17" parent="2" name="sqlite_sequence">
|
||||||
|
<System>1</System>
|
||||||
|
</table>
|
||||||
|
<table id="18" parent="2" name="sync"/>
|
||||||
|
<column id="19" parent="6" name="apiTokenId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="20" parent="6" name="token">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="21" parent="6" name="utcDateCreated">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="22" parent="6" name="isDeleted">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="23" parent="6" name="hash">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>apiTokenId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<key id="25" parent="6">
|
||||||
|
<ColNames>apiTokenId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_api_tokens_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="26" parent="7" name="attributeId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="27" parent="7" name="noteId">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="28" parent="7" name="type">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="29" parent="7" name="name">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="30" parent="7" name="value">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="31" parent="7" name="position">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="32" parent="7" name="utcDateCreated">
|
||||||
|
<Position>7</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="33" parent="7" name="utcDateModified">
|
||||||
|
<Position>8</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="34" parent="7" name="isDeleted">
|
||||||
|
<Position>9</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="35" parent="7" name="deleteId">
|
||||||
|
<Position>10</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<DefaultExpression>NULL</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="36" parent="7" name="hash">
|
||||||
|
<Position>11</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="37" parent="7" name="isInheritable">
|
||||||
|
<Position>12</Position>
|
||||||
|
<DataType>int|0s</DataType>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<index id="38" parent="7" name="sqlite_autoindex_attributes_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>attributeId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="39" parent="7" name="IDX_attributes_noteId_index">
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="40" parent="7" name="IDX_attributes_name_value">
|
||||||
|
<ColNames>name
|
||||||
|
value</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="41" parent="7" name="IDX_attributes_value_index">
|
||||||
|
<ColNames>value</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="42" parent="7">
|
||||||
|
<ColNames>attributeId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_attributes_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="43" parent="8" name="branchId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="44" parent="8" name="noteId">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="45" parent="8" name="parentNoteId">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="46" parent="8" name="notePosition">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="47" parent="8" name="prefix">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="48" parent="8" name="isExpanded">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="49" parent="8" name="isDeleted">
|
||||||
|
<Position>7</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="50" parent="8" name="deleteId">
|
||||||
|
<Position>8</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<DefaultExpression>NULL</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="51" parent="8" name="utcDateModified">
|
||||||
|
<Position>9</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="52" parent="8" name="utcDateCreated">
|
||||||
|
<Position>10</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="53" parent="8" name="hash">
|
||||||
|
<Position>11</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<index id="54" parent="8" name="sqlite_autoindex_branches_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>branchId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="55" parent="8" name="IDX_branches_noteId_parentNoteId">
|
||||||
|
<ColNames>noteId
|
||||||
|
parentNoteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="56" parent="8" name="IDX_branches_parentNoteId">
|
||||||
|
<ColNames>parentNoteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="57" parent="8">
|
||||||
|
<ColNames>branchId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_branches_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="58" parent="9" name="noteId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="59" parent="9" name="content">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<DefaultExpression>NULL</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="60" parent="9" name="hash">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="61" parent="9" name="utcDateModified">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="62" parent="9" name="sqlite_autoindex_note_contents_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<key id="63" parent="9">
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_note_contents_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="64" parent="10" name="noteRevisionId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="65" parent="10" name="content">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="66" parent="10" name="hash">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="67" parent="10" name="utcDateModified">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="68" parent="10" name="sqlite_autoindex_note_revision_contents_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<key id="69" parent="10">
|
||||||
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_note_revision_contents_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="70" parent="11" name="noteRevisionId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="71" parent="11" name="noteId">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="72" parent="11" name="title">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="73" parent="11" name="contentLength">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="74" parent="11" name="isErased">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="75" parent="11" name="isProtected">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="76" parent="11" name="utcDateLastEdited">
|
||||||
|
<Position>7</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="77" parent="11" name="utcDateCreated">
|
||||||
|
<Position>8</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="78" parent="11" name="utcDateModified">
|
||||||
|
<Position>9</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="79" parent="11" name="dateLastEdited">
|
||||||
|
<Position>10</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="80" parent="11" name="dateCreated">
|
||||||
|
<Position>11</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="81" parent="11" name="type">
|
||||||
|
<Position>12</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="82" parent="11" name="mime">
|
||||||
|
<Position>13</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="83" parent="11" name="hash">
|
||||||
|
<Position>14</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>''</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<index id="84" parent="11" name="sqlite_autoindex_note_revisions_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="85" parent="11" name="IDX_note_revisions_noteId">
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="86" parent="11" name="IDX_note_revisions_utcDateLastEdited">
|
||||||
|
<ColNames>utcDateLastEdited</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="87" parent="11" name="IDX_note_revisions_utcDateCreated">
|
||||||
|
<ColNames>utcDateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="88" parent="11" name="IDX_note_revisions_dateLastEdited">
|
||||||
|
<ColNames>dateLastEdited</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="89" parent="11" name="IDX_note_revisions_dateCreated">
|
||||||
|
<ColNames>dateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="90" parent="11">
|
||||||
|
<ColNames>noteRevisionId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="91" parent="12" name="noteId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="92" parent="12" name="title">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>"note"</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="93" parent="12" name="contentLength">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="94" parent="12" name="isProtected">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="95" parent="12" name="type">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>'text'</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="96" parent="12" name="mime">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>'text/html'</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="97" parent="12" name="hash">
|
||||||
|
<Position>7</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="98" parent="12" name="isDeleted">
|
||||||
|
<Position>8</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="99" parent="12" name="deleteId">
|
||||||
|
<Position>9</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<DefaultExpression>NULL</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="100" parent="12" name="isErased">
|
||||||
|
<Position>10</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="101" parent="12" name="dateCreated">
|
||||||
|
<Position>11</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="102" parent="12" name="dateModified">
|
||||||
|
<Position>12</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="103" parent="12" name="utcDateCreated">
|
||||||
|
<Position>13</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="104" parent="12" name="utcDateModified">
|
||||||
|
<Position>14</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="105" parent="12" name="sqlite_autoindex_notes_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="106" parent="12" name="IDX_notes_title">
|
||||||
|
<ColNames>title</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="107" parent="12" name="IDX_notes_type">
|
||||||
|
<ColNames>type</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="108" parent="12" name="IDX_notes_isDeleted">
|
||||||
|
<ColNames>isDeleted</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="109" parent="12" name="IDX_notes_dateCreated">
|
||||||
|
<ColNames>dateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="110" parent="12" name="IDX_notes_dateModified">
|
||||||
|
<ColNames>dateModified</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="111" parent="12" name="IDX_notes_utcDateCreated">
|
||||||
|
<ColNames>utcDateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<index id="112" parent="12" name="IDX_notes_utcDateModified">
|
||||||
|
<ColNames>utcDateModified</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="113" parent="12">
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="114" parent="13" name="name">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="115" parent="13" name="value">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="116" parent="13" name="isSynced">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="117" parent="13" name="hash">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="118" parent="13" name="utcDateCreated">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="119" parent="13" name="utcDateModified">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="120" parent="13" name="sqlite_autoindex_options_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>name</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<key id="121" parent="13">
|
||||||
|
<ColNames>name</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="122" parent="14" name="noteId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="123" parent="14" name="notePath">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="124" parent="14" name="hash">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>""</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="125" parent="14" name="utcDateCreated">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="126" parent="14" name="isDeleted">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<index id="127" parent="14" name="sqlite_autoindex_recent_notes_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<key id="128" parent="14">
|
||||||
|
<ColNames>noteId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="129" parent="15" name="sourceId">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="130" parent="15" name="utcDateCreated">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="131" parent="15" name="sqlite_autoindex_source_ids_1">
|
||||||
|
<NameSurrogate>1</NameSurrogate>
|
||||||
|
<ColNames>sourceId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="132" parent="15" name="IDX_source_ids_utcDateCreated">
|
||||||
|
<ColNames>utcDateCreated</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="133" parent="15">
|
||||||
|
<ColNames>sourceId</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
||||||
|
</key>
|
||||||
|
<column id="134" parent="16" name="type">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="135" parent="16" name="name">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="136" parent="16" name="tbl_name">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="137" parent="16" name="rootpage">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>int|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="138" parent="16" name="sql">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>text|0s</DataType>
|
||||||
|
</column>
|
||||||
|
<column id="139" parent="17" name="name">
|
||||||
|
<Position>1</Position>
|
||||||
|
</column>
|
||||||
|
<column id="140" parent="17" name="seq">
|
||||||
|
<Position>2</Position>
|
||||||
|
</column>
|
||||||
|
<column id="141" parent="18" name="id">
|
||||||
|
<Position>1</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<SequenceIdentity>1</SequenceIdentity>
|
||||||
|
</column>
|
||||||
|
<column id="142" parent="18" name="entityName">
|
||||||
|
<Position>2</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="143" parent="18" name="entityId">
|
||||||
|
<Position>3</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="144" parent="18" name="sourceId">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="145" parent="18" name="isSynced">
|
||||||
|
<Position>5</Position>
|
||||||
|
<DataType>INTEGER|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
|
</column>
|
||||||
|
<column id="146" parent="18" name="utcSyncDate">
|
||||||
|
<Position>6</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="147" parent="18" name="IDX_sync_entityName_entityId">
|
||||||
|
<ColNames>entityName
|
||||||
|
entityId</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
<Unique>1</Unique>
|
||||||
|
</index>
|
||||||
|
<index id="148" parent="18" name="IDX_sync_utcSyncDate">
|
||||||
|
<ColNames>utcSyncDate</ColNames>
|
||||||
|
<ColumnCollations></ColumnCollations>
|
||||||
|
</index>
|
||||||
|
<key id="149" parent="18">
|
||||||
|
<ColNames>id</ColNames>
|
||||||
|
<Primary>1</Primary>
|
||||||
|
</key>
|
||||||
</database-model>
|
</database-model>
|
||||||
</dataSource>
|
</dataSource>
|
@ -110,7 +110,9 @@ async function updateEntity(entity) {
|
|||||||
const primaryKey = entity[primaryKeyName];
|
const primaryKey = entity[primaryKeyName];
|
||||||
|
|
||||||
if (entity.isChanged) {
|
if (entity.isChanged) {
|
||||||
await syncTableService.addEntitySync(entityName, primaryKey);
|
const isSynced = entityName !== 'options' || entity.isSynced;
|
||||||
|
|
||||||
|
await syncTableService.addEntitySync(entityName, primaryKey, isSynced);
|
||||||
|
|
||||||
if (!cls.isEntityEventsDisabled()) {
|
if (!cls.isEntityEventsDisabled()) {
|
||||||
const eventPayload = {
|
const eventPayload = {
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* TODO: rename "sync" table to something like "changelog" since it now also contains rows which are not synced (isSynced=false)
|
||||||
|
*/
|
||||||
|
|
||||||
const sql = require('./sql');
|
const sql = require('./sql');
|
||||||
const sourceIdService = require('./source_id');
|
const sourceIdService = require('./source_id');
|
||||||
const dateUtils = require('./date_utils');
|
const dateUtils = require('./date_utils');
|
||||||
const log = require('./log');
|
const log = require('./log');
|
||||||
const cls = require('./cls');
|
const cls = require('./cls');
|
||||||
|
|
||||||
async function insertEntitySync(entityName, entityId, sourceId) {
|
async function insertEntitySync(entityName, entityId, sourceId, isSynced) {
|
||||||
const sync = {
|
const sync = {
|
||||||
entityName: entityName,
|
entityName: entityName,
|
||||||
entityId: entityId,
|
entityId: entityId,
|
||||||
utcSyncDate: dateUtils.utcNowDateTime(),
|
utcSyncDate: dateUtils.utcNowDateTime(),
|
||||||
sourceId: sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(),
|
sourceId: sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(),
|
||||||
isSynced: 1
|
isSynced: isSynced
|
||||||
};
|
};
|
||||||
|
|
||||||
sync.id = await sql.replace("sync", sync);
|
sync.id = await sql.replace("sync", sync);
|
||||||
@ -18,8 +22,8 @@ async function insertEntitySync(entityName, entityId, sourceId) {
|
|||||||
return sync;
|
return sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addEntitySync(entityName, entityId, sourceId) {
|
async function addEntitySync(entityName, entityId, sourceId, isSynced = true) {
|
||||||
const sync = await insertEntitySync(entityName, entityId, sourceId);
|
const sync = await insertEntitySync(entityName, entityId, sourceId, isSynced);
|
||||||
|
|
||||||
cls.addSyncRow(sync);
|
cls.addSyncRow(sync);
|
||||||
}
|
}
|
||||||
@ -28,7 +32,15 @@ async function addEntitySyncsForSector(entityName, entityPrimaryKey, sector) {
|
|||||||
const entityIds = await sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName} WHERE SUBSTR(${entityPrimaryKey}, 1, 1) = ?`, [sector]);
|
const entityIds = await sql.getColumn(`SELECT ${entityPrimaryKey} FROM ${entityName} WHERE SUBSTR(${entityPrimaryKey}, 1, 1) = ?`, [sector]);
|
||||||
|
|
||||||
for (const entityId of entityIds) {
|
for (const entityId of entityIds) {
|
||||||
await insertEntitySync(entityName, entityId, 'content-check');
|
if (entityName === 'options') {
|
||||||
|
const isSynced = await sql.getValue(`SELECT isSynced FROM options WHERE name = ?`, [entityId]);
|
||||||
|
|
||||||
|
if (!isSynced) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await insertEntitySync(entityName, entityId, 'content-check', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +109,7 @@ module.exports = {
|
|||||||
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),
|
addNoteRevisionContentSync: async (noteRevisionId, sourceId) => await addEntitySync("note_revision_contents", noteRevisionId, sourceId),
|
||||||
addOptionsSync: async (name, sourceId) => await addEntitySync("options", name, sourceId),
|
addOptionsSync: async (name, sourceId, isSynced) => await addEntitySync("options", name, sourceId, isSynced),
|
||||||
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),
|
||||||
addApiTokenSync: async (apiTokenId, sourceId) => await addEntitySync("api_tokens", apiTokenId, sourceId),
|
addApiTokenSync: async (apiTokenId, sourceId) => await addEntitySync("api_tokens", apiTokenId, sourceId),
|
||||||
|
@ -176,7 +176,7 @@ async function updateOptions(remoteEntity, sourceId) {
|
|||||||
if (shouldWeUpdateEntity(localEntity, remoteEntity)) {
|
if (shouldWeUpdateEntity(localEntity, remoteEntity)) {
|
||||||
await sql.replace('options', remoteEntity);
|
await sql.replace('options', remoteEntity);
|
||||||
|
|
||||||
await syncTableService.addOptionsSync(remoteEntity.name, sourceId);
|
await syncTableService.addOptionsSync(remoteEntity.name, sourceId, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user