synchronize(withTable:)
Synchronizes the full-text table with the content of an external table.
func synchronize(withTable tableName: String)
The full-text table is initially populated with the existing content in the external table. SQL triggers make sure that the full-text table is kept up to date with the external table.
SQLite automatically deletes those triggers when the content (not full-text) table is dropped.
However, those triggers remain after the full-text table has been dropped. Unless they are dropped too, they will prevent future insertion, updates, and deletions in the content table, and the creation of a new full-text table.
To drop those triggers, call the Database
dropFTS5SynchronizationTriggers(forTable:)
method:
// Create tables
try db.create(table: "book") { t in
...
}
try db.create(virtualTable: "book_ft", using: FTS5()) { t in
t.synchronize(withTable: "book")
...
}
// Drop full-text table
try db.drop(table: "book_ft")
try db.dropFTS5SynchronizationTriggers(forTable: "book_ft")
Related SQLite documentation: https://sqlite.org/fts5.html#external_content_tables