diff SQLite/Plugins/SQLiteIndex.cpp @ 399:19bd3ee1f0b3 db-protobuf

support for labels in sqlite
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Apr 2023 15:28:47 +0200
parents 3d6886f3e5b3
children 91124cc8a8c7
line wrap: on
line diff
--- a/SQLite/Plugins/SQLiteIndex.cpp	Thu Apr 06 19:09:51 2023 +0200
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Fri Apr 07 15:28:47 2023 +0200
@@ -166,6 +166,23 @@
 
       t.Commit();
     }    
+
+    {
+      DatabaseManager::Transaction t(manager, TransactionType_ReadWrite);
+
+      if (!t.GetDatabaseTransaction().DoesTableExist("Labels"))
+      {
+        t.GetDatabaseTransaction().ExecuteMultiLines(
+          "CREATE TABLE Labels("
+          "  id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,"
+          "  label TEXT NOT NULL,"
+          "  PRIMARY KEY(id, label));"
+          "CREATE INDEX LabelsIndex1 ON Labels(id);"
+          "CREATE INDEX LabelsIndex2 ON Labels(label);");
+      }
+
+      t.Commit();
+    }    
   }