diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 7c09578..d45f1c5 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -265,7 +265,13 @@ def create_index(path, table, column, name, unique, if_not_exists): @click.argument("column", nargs=-1, required=True) @click.option("--fts4", help="Use FTS4", default=False, is_flag=True) @click.option("--fts5", help="Use FTS5", default=False, is_flag=True) -def enable_fts(path, table, column, fts4, fts5): +@click.option( + "--create-update-triggers", + help="Create triggers to update the FTS tables when the parent table changes.", + default=False, + is_flag=True, +) +def enable_fts(path, table, column, fts4, fts5, create_update_triggers): "Enable FTS for specific table and columns" fts_version = "FTS5" if fts4 and fts5: @@ -275,7 +281,9 @@ def enable_fts(path, table, column, fts4, fts5): fts_version = "FTS4" db = sqlite_utils.Database(path) - db[table].enable_fts(column, fts_version=fts_version) + db[table].enable_fts( + column, fts_version=fts_version, create_update_triggers=create_update_triggers + ) @cli.command(name="populate-fts")