Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509623
D3155.id9533.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D3155.id9533.diff
View Options
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -3,6 +3,7 @@
#include "sqlite_orm.h"
#include "entities/Media.h"
+#include "entities/Metadata.h"
#include <sqlite3.h>
#include <cerrno>
#include <cstdio>
@@ -243,6 +244,14 @@
return false;
}
+bool create_metadata_table(sqlite3 *db) {
+ std::string query =
+ "CREATE TABLE IF NOT EXISTS metadata ( "
+ "name TEXT UNIQUE PRIMARY KEY NOT NULL, "
+ "data TEXT);";
+ return create_table(db, query, "metadata");
+}
+
void set_encryption_key(sqlite3 *db) {
std::string set_encryption_key_query =
"PRAGMA key = \"x'" + SQLiteQueryExecutor::encryptionKey + "'\";";
@@ -383,7 +392,8 @@
{19, {create_media_idx_container, true}},
{20, {create_threads_table, true}},
{21, {update_threadID_for_pending_threads_in_drafts, true}},
- {22, {enable_write_ahead_logging_mode, false}}}};
+ {22, {enable_write_ahead_logging_mode, false}},
+ {23, {create_metadata_table, true}}}};
void SQLiteQueryExecutor::migrate() {
validate_encryption();
@@ -492,7 +502,11 @@
make_column("roles", &Thread::roles),
make_column("current_user", &Thread::current_user),
make_column("source_message_id", &Thread::source_message_id),
- make_column("replies_count", &Thread::replies_count)));
+ make_column("replies_count", &Thread::replies_count)),
+ make_table(
+ "metadata",
+ make_column("name", &Metadata::name, unique(), primary_key()),
+ make_column("data", &Metadata::data)));
storage.on_open = set_encryption_key;
return storage;
}
diff --git a/native/cpp/CommonCpp/DatabaseManagers/entities/Metadata.h b/native/cpp/CommonCpp/DatabaseManagers/entities/Metadata.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/DatabaseManagers/entities/Metadata.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <string>
+
+namespace comm {
+
+struct Metadata {
+ std::string name;
+ std::string data;
+};
+
+} // namespace comm
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -62,6 +62,7 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Comm/main.m; sourceTree = "<group>"; };
2DDA00CA889DFF0ECB7E338D /* ClientGetReadReactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClientGetReadReactor.cpp; sourceTree = "<group>"; };
2DDA05D6D8D20D885F22F82C /* SocketStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStatus.h; sourceTree = "<group>"; };
+ 2DDA0A22FECC9DAA5C19C35D /* Metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Metadata.h; sourceTree = "<group>"; };
71009A7326FDCA67002C8453 /* tunnelbroker.pb.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tunnelbroker.pb.cc; sourceTree = "<group>"; };
71009A7426FDCA67002C8453 /* tunnelbroker.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tunnelbroker.pb.h; sourceTree = "<group>"; };
71009A7526FDCA67002C8453 /* tunnelbroker.grpc.pb.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tunnelbroker.grpc.pb.cc; sourceTree = "<group>"; };
@@ -301,6 +302,7 @@
71BE84452636A944002849D2 /* Draft.h */,
B70FBC1226B047050040F480 /* Message.h */,
B7E937CA26F448E700022A7C /* Media.h */,
+ 2DDA0A22FECC9DAA5C19C35D /* Metadata.h */,
);
path = entities;
sourceTree = "<group>";
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 6:53 AM (5 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690234
Default Alt Text
D3155.id9533.diff (3 KB)
Attached To
Mode
D3155: [CommCoreModule] Add `metadata` table to client DB
Attached
Detach File
Event Timeline
Log In to Comment