mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-27 11:24:33 +02:00
parent
d302835d57
commit
7a52214624
8 changed files with 137 additions and 1 deletions
|
|
@ -291,6 +291,24 @@ def test_create_index(db_path):
|
|||
)
|
||||
|
||||
|
||||
def test_drop_index(db_path):
|
||||
db = Database(db_path)
|
||||
db["Gosh"].create_index(["c1"])
|
||||
assert [index.name for index in db["Gosh"].indexes] == ["idx_Gosh_c1"]
|
||||
result = CliRunner().invoke(cli.cli, ["drop-index", db_path, "Gosh", "idx_Gosh_c1"])
|
||||
assert result.exit_code == 0
|
||||
assert db["Gosh"].indexes == []
|
||||
|
||||
result = CliRunner().invoke(cli.cli, ["drop-index", db_path, "Gosh", "idx_Gosh_c1"])
|
||||
assert result.exit_code == 1
|
||||
assert "No index named idx_Gosh_c1" in result.output
|
||||
|
||||
result = CliRunner().invoke(
|
||||
cli.cli, ["drop-index", db_path, "Gosh", "idx_Gosh_c1", "--ignore"]
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
||||
|
||||
def test_create_index_analyze(db_path):
|
||||
db = Database(db_path)
|
||||
assert "sqlite_stat1" not in db.table_names()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue