forked from cory/tildefriends
		
	Slightly more honest startup messaging.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4001 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/ssb.db.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/ssb.db.c
									
									
									
									
									
								
							| @@ -107,10 +107,25 @@ void tf_ssb_db_init(tf_ssb_t* ssb) | ||||
| 		")"); | ||||
| 	_tf_ssb_db_exec(db, "CREATE INDEX IF NOT EXISTS identities_user ON identities (user, public_key)"); | ||||
|  | ||||
| 	if (!_tf_ssb_db_has_rows(db, "PRAGMA table_list('messages_fts')") || | ||||
| 		sqlite3_exec(db, "INSERT INTO messages_fts(messages_fts, rank) VALUES ('integrity-check', 0)", NULL, NULL, NULL) == SQLITE_CORRUPT_VTAB) | ||||
| 	bool populate_fts = false; | ||||
| 	if (!_tf_ssb_db_has_rows(db, "PRAGMA table_list('messages_fts')")) | ||||
| 	{ | ||||
| 		_tf_ssb_db_exec(db, "CREATE VIRTUAL TABLE IF NOT EXISTS messages_fts USING fts5(content, content=messages, content_rowid=rowid)"); | ||||
| 		populate_fts = true; | ||||
| 	} | ||||
|  | ||||
| 	if (!populate_fts) | ||||
| 	{ | ||||
| 		printf("Checking FTS5 integrity...\n"); | ||||
| 		if (sqlite3_exec(db, "INSERT INTO messages_fts(messages_fts, rank) VALUES ('integrity-check', 0)", NULL, NULL, NULL) == SQLITE_CORRUPT_VTAB) | ||||
| 		{ | ||||
| 			populate_fts = true; | ||||
| 		} | ||||
| 		printf("Done.\n"); | ||||
| 	} | ||||
|  | ||||
| 	if (populate_fts) | ||||
| 	{ | ||||
| 		printf("Populating full-text search...\n"); | ||||
| 		_tf_ssb_db_exec(db, "INSERT INTO messages_fts (rowid, content) SELECT rowid, content FROM messages"); | ||||
| 		printf("Done.\n"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user