Add cli option for the create-update-trigger.

This commit is contained in:
Amjith Ramanujam 2019-09-01 21:18:32 -07:00
commit aef825c140

View file

@ -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")