diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 27c46b0af..08fc5248f 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -1622,6 +1622,7 @@ def transform( to use when creating the table. """ assert self.exists(), "Cannot transform a table that doesn't exist yet" + fts_table = self.detect_fts() sqls = self.transform_sql( types=types, rename=rename, @@ -1632,6 +1633,10 @@ def transform( drop_foreign_keys=drop_foreign_keys, column_order=column_order, ) + if fts_table: + fts_columns = [c.name for c in self.db[fts_table].columns if c.name not in drop] + fts_columns_renamed = [renamed[c] if c in renamed else c for c in fts_columns] + self.enable_fts(fts_columns_renamed, replace=True) pragma_foreign_keys_was_on = self.db.execute("PRAGMA foreign_keys").fetchone()[ 0 ]