SQLDatabase
extension SQLDatabase
Shared helpers for the Create*SearchIndexes migrations (see SearchIndexCreation.swift,
SeamailSearchIndexCreation.swift, QuartermasterSearchIndexCreation.swift), which each add a
stored generated fulltext_search tsvector column plus a GIN index to one or more tables.
Centralized here so the full-text index strategy only needs to change in one place.
-
Adds a
fulltext_searchtsvector column totableName, generated fromtsvectorExpression(a raw SQL expression, e.g."to_tsvector('english', text)"), and creates a GIN index over it.Declaration
Swift
func addFullTextSearchColumn(tableName: String, tsvectorExpression: String) async throws -
createSearchIndex(tableName:Asynchronous) Declaration
Swift
func createSearchIndex(tableName: String) async throws -
dropSearchIndexAndColumn(tableName:Asynchronous) Declaration
Swift
func dropSearchIndexAndColumn(tableName: String) async throws
View on GitHub