mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
synchronize: failing test for FTS5 ifNotExists support
This commit is contained in:
1 parent
1a2de126ce
commit
1aeb10439f
1 file changed
+24
@@ -252,6 +252,30 @@ class FTS5TableBuilderTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS5SynchronizationIfNotExists() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.writeWithoutTransaction { db in
|
||||
try db.create(table: "documents") { t in
|
||||
t.column("id", .integer).primaryKey()
|
||||
t.column("content", .text)
|
||||
}
|
||||
assertDidExecute(sql: "CREATE TABLE \"documents\" (\"id\" INTEGER PRIMARY KEY, \"content\" TEXT)")
|
||||
try db.create(virtualTable: "ft_documents", ifNotExists: true, using: FTS5()) { t in
|
||||
t.synchronize(withTable: "documents")
|
||||
t.column("content")
|
||||
}
|
||||
|
||||
assertDidExecute(sql: """
|
||||
CREATE VIRTUAL TABLE IF NOT EXISTS "ft_documents" USING fts5(content, content='documents', content_rowid='id')
|
||||
""")
|
||||
assertDidExecute(sql: """
|
||||
CREATE TRIGGER IF NOT EXISTS "__ft_documents_ai" AFTER INSERT ON "documents" BEGIN
|
||||
INSERT INTO "ft_documents"("rowid", "content") VALUES (new."id", new."content");
|
||||
END
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
func testFTS5SynchronizationCleanup() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.inDatabase { db in
|
||||
|
||||
Reference in new issue
Block a user