π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Enable foreign keys
vishnukvmd904a010abfb5
diff --git a/lib/db/files_db.dart b/lib/db/files_db.dartindex 52852e5c12..69d98f8d2b 100644--- a/lib/db/files_db.dart+++ b/lib/db/files_db.dart@@ -73,7 +73,10 @@ class FilesDB {// we need to write query based on that fieldstatic const columnMMdVisibility = 'mmd_visibility';- static final initializationScript = [...createTable(filesTable)];+ static final initializationScript = [+ enableForeignKeys(),+ ...createTable(filesTable),+ ];static final migrationScripts = [...alterDeviceFolderToAllowNULL(),...alterTimestampColumnTypes(),@@ -118,6 +121,10 @@ class FilesDB {return await openDatabaseWithMigration(path, dbConfig);}+ static String enableForeignKeys() {+ return "PRAGMA foreign_keys = ON;";+ }+// SQL code to create the database tablestatic List<String> createTable(String tableName) {return [@@ -390,7 +397,8 @@ class FilesDB {CREATE TABLE IF NOT EXISTS $embeddingsTable ($columnGeneratedID INTEGER PRIMARY KEY,$columnEmbedding TEXT NOT NULL,- $columnUpdationTime INTEGER NOT NULL DEFAULT -1+ $columnUpdationTime INTEGER NOT NULL DEFAULT -1,+ FOREIGN KEY($columnGeneratedID) REFERENCES $filesTable($columnGeneratedID));'''];