mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
table.rebuild_fts() method, refs #155
This commit is contained in:
parent
deb2eb013f
commit
4c0f79398f
3 changed files with 52 additions and 0 deletions
|
|
@ -905,6 +905,17 @@ class Table(Queryable):
|
|||
for trigger_name in trigger_names:
|
||||
self.db.execute("DROP TRIGGER IF EXISTS [{}]".format(trigger_name))
|
||||
|
||||
def rebuild_fts(self):
|
||||
fts_table = self.detect_fts()
|
||||
if fts_table is None:
|
||||
# Assume this is itself an FTS table
|
||||
fts_table = self.name
|
||||
self.db.execute(
|
||||
"INSERT INTO [{table}]([{table}]) VALUES('rebuild');".format(
|
||||
table=fts_table
|
||||
)
|
||||
)
|
||||
|
||||
def detect_fts(self):
|
||||
"Detect if table has a corresponding FTS virtual table and return it"
|
||||
sql = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue