mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 04:44:26 +02:00
sqlite-utils optimize command, .optimize() and .detect_fts() table methods
This commit is contained in:
parent
015bd2a840
commit
0a8194e730
7 changed files with 146 additions and 4 deletions
|
|
@ -6,14 +6,30 @@ def test_table_names(existing_db):
|
|||
|
||||
|
||||
def test_table_names_fts4(existing_db):
|
||||
existing_db["woo"].insert({"title": "Hello"})
|
||||
existing_db["woo2"].insert({"title": "Hello"})
|
||||
existing_db["woo"].enable_fts(["title"], fts_version="FTS4")
|
||||
existing_db["woo2"].enable_fts(["title"], fts_version="FTS5")
|
||||
existing_db["woo"].insert({"title": "Hello"}).enable_fts(
|
||||
["title"], fts_version="FTS4"
|
||||
)
|
||||
existing_db["woo2"].insert({"title": "Hello"}).enable_fts(
|
||||
["title"], fts_version="FTS5"
|
||||
)
|
||||
assert ["woo_fts"] == existing_db.table_names(fts4=True)
|
||||
assert ["woo2_fts"] == existing_db.table_names(fts5=True)
|
||||
|
||||
|
||||
def test_detect_fts(existing_db):
|
||||
existing_db["woo"].insert({"title": "Hello"}).enable_fts(
|
||||
["title"], fts_version="FTS4"
|
||||
)
|
||||
existing_db["woo2"].insert({"title": "Hello"}).enable_fts(
|
||||
["title"], fts_version="FTS5"
|
||||
)
|
||||
assert "woo_fts" == existing_db["woo"].detect_fts()
|
||||
assert "woo_fts" == existing_db["woo_fts"].detect_fts()
|
||||
assert "woo2_fts" == existing_db["woo2"].detect_fts()
|
||||
assert "woo2_fts" == existing_db["woo2_fts"].detect_fts()
|
||||
assert None == existing_db["foo"].detect_fts()
|
||||
|
||||
|
||||
def test_tables(existing_db):
|
||||
assert 1 == len(existing_db.tables)
|
||||
assert "foo" == existing_db.tables[0].name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue