Skip to content

Build your personal knowledge base with Trilium Notes

non null note title and content in the DB schema, allow saving non-valid JSON notes, children overview style changes

azivnera4eafb934ff3
diff --git a/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml b/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml
index 953e5646b3..6c23a85afe 100644
--- a/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml
+++ b/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<dataSource name="document.db">
- <database-model serializer="dbm" rdbms="SQLITE" format-version="4.7">
- <root id="1"/>
+ <database-model serializer="dbm" rdbms="SQLITE" format-version="4.8">
+ <root id="1">
+ <ServerVersion>3.16.1</ServerVersion>
+ </root>
<schema id="2" parent="1" name="main">
<Current>1</Current>
<Visible>1</Visible>
@@ -107,8 +109,7 @@
<index id="35" parent="7" name="IDX_branches_noteId_parentNoteId">
<ColNames>noteId
parentNoteId</ColNames>
- <ColumnCollations>
-</ColumnCollations>
+ <ColumnCollations></ColumnCollations>
</index>
<index id="36" parent="7" name="IDX_branches_noteId">
<ColNames>noteId</ColNames>
@@ -142,445 +143,449 @@ parentNoteId</ColNames>
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
- <foreign-key id="43" parent="8">
- <ColNames>noteId</ColNames>
- <RefTableName>notes</RefTableName>
- <RefColNames>noteId</RefColNames>
- </foreign-key>
- <column id="44" parent="9" name="imageId">
+ <column id="43" parent="9" name="imageId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="45" parent="9" name="format">
+ <column id="44" parent="9" name="format">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="46" parent="9" name="checksum">
+ <column id="45" parent="9" name="checksum">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="47" parent="9" name="name">
+ <column id="46" parent="9" name="name">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="48" parent="9" name="data">
+ <column id="47" parent="9" name="data">
<Position>5</Position>
<DataType>BLOB|0s</DataType>
</column>
- <column id="49" parent="9" name="isDeleted">
+ <column id="48" parent="9" name="isDeleted">
<Position>6</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="50" parent="9" name="dateModified">
+ <column id="49" parent="9" name="dateModified">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="51" parent="9" name="dateCreated">
+ <column id="50" parent="9" name="dateCreated">
<Position>8</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="52" parent="9" name="sqlite_autoindex_images_1">
+ <index id="51" parent="9" name="sqlite_autoindex_images_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>imageId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <key id="53" parent="9">
+ <key id="52" parent="9">
<ColNames>imageId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_images_1</UnderlyingIndexName>
</key>
- <column id="54" parent="10" name="labelId">
+ <column id="53" parent="10" name="labelId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="55" parent="10" name="noteId">
+ <column id="54" parent="10" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="56" parent="10" name="name">
+ <column id="55" parent="10" name="name">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="57" parent="10" name="value">
+ <column id="56" parent="10" name="value">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
- <column id="58" parent="10" name="position">
+ <column id="57" parent="10" name="position">
<Position>5</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="59" parent="10" name="dateCreated">
+ <column id="58" parent="10" name="dateCreated">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="60" parent="10" name="dateModified">
+ <column id="59" parent="10" name="dateModified">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="61" parent="10" name="isDeleted">
+ <column id="60" parent="10" name="isDeleted">
<Position>8</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="62" parent="10" name="sqlite_autoindex_labels_1">
+ <index id="61" parent="10" name="sqlite_autoindex_labels_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>labelId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <index id="63" parent="10" name="IDX_labels_noteId">
+ <index id="62" parent="10" name="IDX_labels_noteId">
<ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <index id="64" parent="10" name="IDX_labels_name_value">
+ <index id="63" parent="10" name="IDX_labels_name_value">
<ColNames>name
value</ColNames>
- <ColumnCollations>
-</ColumnCollations>
+ <ColumnCollations></ColumnCollations>
</index>
- <key id="65" parent="10">
+ <key id="64" parent="10">
<ColNames>labelId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_labels_1</UnderlyingIndexName>
</key>
- <column id="66" parent="11" name="noteImageId">
+ <column id="65" parent="11" name="noteImageId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="67" parent="11" name="noteId">
+ <column id="66" parent="11" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="68" parent="11" name="imageId">
+ <column id="67" parent="11" name="imageId">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="69" parent="11" name="isDeleted">
+ <column id="68" parent="11" name="isDeleted">
<Position>4</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="70" parent="11" name="dateModified">
+ <column id="69" parent="11" name="dateModified">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="71" parent="11" name="dateCreated">
+ <column id="70" parent="11" name="dateCreated">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="72" parent="11" name="sqlite_autoindex_note_images_1">
+ <index id="71" parent="11" name="sqlite_autoindex_note_images_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteImageId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <index id="73" parent="11" name="IDX_note_images_noteId_imageId">
+ <index id="72" parent="11" name="IDX_note_images_noteId_imageId">
<ColNames>noteId
imageId</ColNames>
- <ColumnCollations>
-</ColumnCollations>
+ <ColumnCollations></ColumnCollations>
</index>
- <index id="74" parent="11" name="IDX_note_images_noteId">
+ <index id="73" parent="11" name="IDX_note_images_noteId">
<ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <index id="75" parent="11" name="IDX_note_images_imageId">
+ <index id="74" parent="11" name="IDX_note_images_imageId">
<ColNames>imageId</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <key id="76" parent="11">
+ <key id="75" parent="11">
<ColNames>noteImageId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_note_images_1</UnderlyingIndexName>
</key>
- <column id="77" parent="12" name="noteRevisionId">
+ <column id="76" parent="12" name="noteRevisionId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="78" parent="12" name="noteId">
+ <column id="77" parent="12" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="79" parent="12" name="title">
+ <column id="78" parent="12" name="title">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
</column>
- <column id="80" parent="12" name="content">
+ <column id="79" parent="12" name="content">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
</column>
- <column id="81" parent="12" name="isProtected">
+ <column id="80" parent="12" name="isProtected">
<Position>5</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="82" parent="12" name="dateModifiedFrom">
+ <column id="81" parent="12" name="dateModifiedFrom">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="83" parent="12" name="dateModifiedTo">
+ <column id="82" parent="12" name="dateModifiedTo">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="84" parent="12" name="sqlite_autoindex_note_revisions_1">
+ <column id="83" parent="12" name="type">
+ <Position>8</Position>
+ <DataType>TEXT|0s</DataType>
+ <NotNull>1</NotNull>
+ <DefaultExpression>&apos;&apos;</DefaultExpression>
+ </column>
+ <column id="84" parent="12" name="mime">
+ <Position>9</Position>
+ <DataType>TEXT|0s</DataType>
+ <NotNull>1</NotNull>
+ <DefaultExpression>&apos;&apos;</DefaultExpression>
+ </column>
+ <index id="85" parent="12" name="sqlite_autoindex_note_revisions_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteRevisionId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <index id="85" parent="12" name="IDX_note_revisions_noteId">
+ <index id="86" parent="12" name="IDX_note_revisions_noteId">
<ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <index id="86" parent="12" name="IDX_note_revisions_dateModifiedFrom">
+ <index id="87" parent="12" name="IDX_note_revisions_dateModifiedFrom">
<ColNames>dateModifiedFrom</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <index id="87" parent="12" name="IDX_note_revisions_dateModifiedTo">
+ <index id="88" parent="12" name="IDX_note_revisions_dateModifiedTo">
<ColNames>dateModifiedTo</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <key id="88" parent="12">
+ <key id="89" parent="12">
<ColNames>noteRevisionId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
</key>
- <column id="89" parent="13" name="noteId">
+ <column id="90" parent="13" name="noteId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="90" parent="13" name="title">
+ <column id="91" parent="13" name="title">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
</column>
- <column id="91" parent="13" name="content">
+ <column id="92" parent="13" name="content">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
</column>
- <column id="92" parent="13" name="isProtected">
+ <column id="93" parent="13" name="isProtected">
<Position>4</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="93" parent="13" name="isDeleted">
+ <column id="94" parent="13" name="isDeleted">
<Position>5</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <column id="94" parent="13" name="dateCreated">
+ <column id="95" parent="13" name="dateCreated">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="95" parent="13" name="dateModified">
+ <column id="96" parent="13" name="dateModified">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="96" parent="13" name="type">
+ <column id="97" parent="13" name="type">
<Position>8</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;text&apos;</DefaultExpression>
</column>
- <column id="97" parent="13" name="mime">
+ <column id="98" parent="13" name="mime">
<Position>9</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;text/html&apos;</DefaultExpression>
</column>
- <index id="98" parent="13" name="sqlite_autoindex_notes_1">
+ <index id="99" parent="13" name="sqlite_autoindex_notes_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <index id="99" parent="13" name="IDX_notes_isDeleted">
+ <index id="100" parent="13" name="IDX_notes_isDeleted">
<ColNames>isDeleted</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <key id="100" parent="13">
+ <key id="101" parent="13">
<ColNames>noteId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
</key>
- <column id="101" parent="14" name="name">
+ <column id="102" parent="14" name="name">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="102" parent="14" name="value">
+ <column id="103" parent="14" name="value">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
</column>
- <column id="103" parent="14" name="dateModified">
+ <column id="104" parent="14" name="dateModified">
<Position>3</Position>
<DataType>INT|0s</DataType>
</column>
- <column id="104" parent="14" name="isSynced">
+ <column id="105" parent="14" name="isSynced">
<Position>4</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
- <index id="105" parent="14" name="sqlite_autoindex_options_1">
+ <index id="106" parent="14" name="sqlite_autoindex_options_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>name</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <key id="106" parent="14">
+ <key id="107" parent="14">
<ColNames>name</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
</key>
- <column id="107" parent="15" name="branchId">
+ <column id="108" parent="15" name="branchId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="108" parent="15" name="notePath">
+ <column id="109" parent="15" name="notePath">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="109" parent="15" name="dateAccessed">
+ <column id="110" parent="15" name="dateAccessed">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="110" parent="15" name="isDeleted">
+ <column id="111" parent="15" name="isDeleted">
<Position>4</Position>
<DataType>INT|0s</DataType>
</column>
- <index id="111" parent="15" name="sqlite_autoindex_recent_notes_1">
+ <index id="112" parent="15" name="sqlite_autoindex_recent_notes_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>branchId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <key id="112" parent="15">
+ <key id="113" parent="15">
<ColNames>branchId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
</key>
- <column id="113" parent="16" name="sourceId">
+ <column id="114" parent="16" name="sourceId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="114" parent="16" name="dateCreated">
+ <column id="115" parent="16" name="dateCreated">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="115" parent="16" name="sqlite_autoindex_source_ids_1">
+ <index id="116" parent="16" name="sqlite_autoindex_source_ids_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>sourceId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <key id="116" parent="16">
+ <key id="117" parent="16">
<ColNames>sourceId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
</key>
- <column id="117" parent="17" name="type">
+ <column id="118" parent="17" name="type">
<Position>1</Position>
<DataType>text|0s</DataType>
</column>
- <column id="118" parent="17" name="name">
+ <column id="119" parent="17" name="name">
<Position>2</Position>
<DataType>text|0s</DataType>
</column>
- <column id="119" parent="17" name="tbl_name">
+ <column id="120" parent="17" name="tbl_name">
<Position>3</Position>
<DataType>text|0s</DataType>
</column>
- <column id="120" parent="17" name="rootpage">
+ <column id="121" parent="17" name="rootpage">
<Position>4</Position>
<DataType>integer|0s</DataType>
</column>
- <column id="121" parent="17" name="sql">
+ <column id="122" parent="17" name="sql">
<Position>5</Position>
<DataType>text|0s</DataType>
</column>
- <column id="122" parent="18" name="name">
+ <column id="123" parent="18" name="name">
<Position>1</Position>
</column>
- <column id="123" parent="18" name="seq">
+ <column id="124" parent="18" name="seq">
<Position>2</Position>
</column>
- <column id="124" parent="19" name="id">
+ <column id="125" parent="19" name="id">
<Position>1</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
- <column id="125" parent="19" name="entityName">
+ <column id="126" parent="19" name="entityName">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="126" parent="19" name="entityId">
+ <column id="127" parent="19" name="entityId">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="127" parent="19" name="sourceId">
+ <column id="128" parent="19" name="sourceId">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <column id="128" parent="19" name="syncDate">
+ <column id="129" parent="19" name="syncDate">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
- <index id="129" parent="19" name="IDX_sync_entityName_entityId">
+ <index id="130" parent="19" name="IDX_sync_entityName_entityId">
<ColNames>entityName
entityId</ColNames>
- <ColumnCollations>
-</ColumnCollations>
+ <ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
- <index id="130" parent="19" name="IDX_sync_syncDate">
+ <index id="131" parent="19" name="IDX_sync_syncDate">
<ColNames>syncDate</ColNames>
<ColumnCollations></ColumnCollations>
</index>
- <key id="131" parent="19">
+ <key id="132" parent="19">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
diff --git a/db/migrations/0088__non_null_note_title_content.sql b/db/migrations/0088__non_null_note_title_content.sql
new file mode 100644
index 0000000000..313c2551b1
--- /dev/null
+++ b/db/migrations/0088__non_null_note_title_content.sql
@@ -0,0 +1,34 @@
+CREATE TABLE event_logc027
+(
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ noteId TEXT,
+ comment TEXT,
+ dateAdded TEXT NOT NULL
+);
+INSERT INTO event_logc027(id, noteId, comment, dateAdded) SELECT id, noteId, comment, dateAdded FROM event_log;
+DROP TABLE event_log;
+ALTER TABLE event_logc027 RENAME TO event_log;
+
+CREATE TABLE IF NOT EXISTS "notes_mig" (
+ `noteId` TEXT NOT NULL,
+ `title` TEXT NOT NULL DEFAULT "unnamed",
+ `content` TEXT NOT NULL DEFAULT "",
+ `isProtected` INT NOT NULL DEFAULT 0,
+ `isDeleted` INT NOT NULL DEFAULT 0,
+ `dateCreated` TEXT NOT NULL,
+ `dateModified` TEXT NOT NULL,
+ type TEXT NOT NULL DEFAULT 'text',
+ mime TEXT NOT NULL DEFAULT 'text/html',
+ PRIMARY KEY(`noteId`)
+);
+
+INSERT INTO notes_mig (noteId, title, content, isProtected, isDeleted, dateCreated, dateModified, type, mime)
+ SELECT noteId, title, content, isProtected, isDeleted, dateCreated, dateModified, type, mime FROM notes;
+
+DROP TABLE notes;
+
+ALTER TABLE notes_mig RENAME TO notes;
+
+CREATE INDEX `IDX_notes_isDeleted` ON `notes` (
+ `isDeleted`
+);
\ No newline at end of file
diff --git a/db/schema.sql b/db/schema.sql
index d2cdd01ca8..969927a842 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -21,28 +21,6 @@ CREATE TABLE IF NOT EXISTS "source_ids" (
`dateCreated` TEXT NOT NULL,
PRIMARY KEY(`sourceId`)
);
-CREATE TABLE IF NOT EXISTS "notes" (
- `noteId` TEXT NOT NULL,
- `title` TEXT,
- `content` TEXT,
- `isProtected` INT NOT NULL DEFAULT 0,
- `isDeleted` INT NOT NULL DEFAULT 0,
- `dateCreated` TEXT NOT NULL,
- `dateModified` TEXT NOT NULL,
- type TEXT NOT NULL DEFAULT 'text',
- mime TEXT NOT NULL DEFAULT 'text/html',
- PRIMARY KEY(`noteId`)
-);
-CREATE INDEX `IDX_notes_isDeleted` ON `notes` (
- `isDeleted`
-);
-CREATE TABLE IF NOT EXISTS "event_log" (
- `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- `noteId` TEXT,
- `comment` TEXT,
- `dateAdded` TEXT NOT NULL,
- FOREIGN KEY(noteId) REFERENCES notes(noteId)
-);
CREATE TABLE IF NOT EXISTS "note_revisions" (
`noteRevisionId` TEXT NOT NULL PRIMARY KEY,
`noteId` TEXT NOT NULL,
@@ -51,7 +29,7 @@ CREATE TABLE IF NOT EXISTS "note_revisions" (
`isProtected` INT NOT NULL DEFAULT 0,
`dateModifiedFrom` TEXT NOT NULL,
`dateModifiedTo` TEXT NOT NULL
-);
+, type TEXT DEFAULT '' NOT NULL, mime TEXT DEFAULT '' NOT NULL);
CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (
`noteId`
);
@@ -130,3 +108,25 @@ CREATE INDEX IDX_labels_name_value
on labels (name, value);
CREATE INDEX IDX_labels_noteId
on labels (noteId);
+CREATE TABLE IF NOT EXISTS "event_log"
+(
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ noteId TEXT,
+ comment TEXT,
+ dateAdded TEXT NOT NULL
+);
+CREATE TABLE IF NOT EXISTS "notes" (
+ `noteId` TEXT NOT NULL,
+ `title` TEXT NOT NULL DEFAULT "unnamed",
+ `content` TEXT NOT NULL DEFAULT "",
+ `isProtected` INT NOT NULL DEFAULT 0,
+ `isDeleted` INT NOT NULL DEFAULT 0,
+ `dateCreated` TEXT NOT NULL,
+ `dateModified` TEXT NOT NULL,
+ type TEXT NOT NULL DEFAULT 'text',
+ mime TEXT NOT NULL DEFAULT 'text/html',
+ PRIMARY KEY(`noteId`)
+);
+CREATE INDEX `IDX_notes_isDeleted` ON `notes` (
+ `isDeleted`
+);
diff --git a/src/entities/note.js b/src/entities/note.js
index 9f599c5f19..c14cb18246 100644
--- a/src/entities/note.js
+++ b/src/entities/note.js
@@ -17,17 +17,16 @@ class Note extends Entity {
protected_session.decryptNote(this);
}
- if (this.isJson()) {
- this.jsonContent = JSON.parse(this.content);
- }
+ this.setContent(this.content);
}
setContent(content) {
this.content = content;
- if (this.isJson()) {
+ try {
this.jsonContent = JSON.parse(this.content);
}
+ catch(e) {}
}
isJson() {
@@ -142,7 +141,7 @@ class Note extends Entity {
beforeSaving() {
super.beforeSaving();
- if (this.isJson()) {
+ if (this.isJson() && this.jsonContent) {
this.content = JSON.stringify(this.jsonContent, null, '\t');
}
diff --git a/src/public/javascripts/entities/note_full.js b/src/public/javascripts/entities/note_full.js
index 0f500b36ee..4e6daf9314 100644
--- a/src/public/javascripts/entities/note_full.js
+++ b/src/public/javascripts/entities/note_full.js
@@ -6,8 +6,11 @@ class NoteFull extends NoteShort {
this.content = row.content;
- if (this.isJson()) {
- this.jsonContent = JSON.parse(this.content);
+ if (this.content !== "" && this.isJson()) {
+ try {
+ this.jsonContent = JSON.parse(this.content);
+ }
+ catch(e) {}
}
}
}
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index 8b3bc0a0bf..a99b283c23 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -249,7 +249,7 @@ div.ui-tooltip {
}
#note-detail-code {
- height: 100%;
+ min-height: 200px;
}
.CodeMirror {
@@ -291,6 +291,14 @@ div.ui-tooltip {
}
#children-overview {
+ flex-grow: 1000;
+ flex-shrink: 1000;
+ flex-basis: 0px;
+ display: flex;
+ flex-wrap: wrap;
+ align-content: flex-start;
+ height: 100px;
+ overflow: auto;
}
.child-overview {
@@ -299,12 +307,15 @@ div.ui-tooltip {
padding: 10px;
background: #f4f4f4;
width: 150px;
- height: 95px;
+ height: 90px;
+ line-height: 2em;
margin-right: 20px;
border-radius: 15px;
overflow: hidden;
text-align: center;
margin-top: 15px;
+ text-overflow: ellipsis;
+ word-wrap: break-word;
}
.child-overview a {
diff --git a/src/services/app_info.js b/src/services/app_info.js
index 0afd742035..3c2a5cd6b5 100644
--- a/src/services/app_info.js
+++ b/src/services/app_info.js
@@ -3,7 +3,7 @@
const build = require('./build');
const packageJson = require('../../package');
-const APP_DB_VERSION = 87;
+const APP_DB_VERSION = 88;
module.exports = {
appVersion: packageJson.version,
diff --git a/src/views/index.ejs b/src/views/index.ejs
index b98616b696..69bdad9c54 100644
--- a/src/views/index.ejs
+++ b/src/views/index.ejs
@@ -205,8 +205,7 @@
<input type="file" id="file-upload" style="display: none" />
</div>
- <div id="children-overview" style="flex-grow: 1000; flex-shrink: 1000; flex-basis: 0px; height: 100px; overflow: auto; display: flex; flex-wrap: wrap">
- </div>
+ <div id="children-overview"></div>
</div>
<div id="label-list">