mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 03:24:23 +02:00
Clarifying comments
This commit is contained in:
parent
e31dbf3f37
commit
c47a2a42bc
2 changed files with 4 additions and 1 deletions
|
|
@ -1969,7 +1969,7 @@ class Table(Queryable):
|
|||
)
|
||||
# Re-add existing indexes
|
||||
for index in self.indexes:
|
||||
if index.origin not in ("pk"):
|
||||
if index.origin != "pk":
|
||||
index_sql = self.db.execute(
|
||||
"""SELECT sql FROM sqlite_master WHERE type = 'index' AND name = :index_name;""",
|
||||
{"index_name": index.name},
|
||||
|
|
|
|||
|
|
@ -551,6 +551,8 @@ def test_transform_strict(fresh_db, strict):
|
|||
],
|
||||
)
|
||||
def test_transform_indexes(fresh_db, indexes, transform_params):
|
||||
# https://github.com/simonw/sqlite-utils/issues/633
|
||||
# New table should have same indexes as old table after transformation
|
||||
dogs = fresh_db["dogs"]
|
||||
dogs.insert({"id": 1, "name": "Cleo", "age": 5, "breed": "Labrador"}, pk="id")
|
||||
|
||||
|
|
@ -617,6 +619,7 @@ def test_transform_retains_indexes_with_foreign_keys(fresh_db):
|
|||
],
|
||||
)
|
||||
def test_transform_with_indexes_errors(fresh_db, transform_params):
|
||||
# Should error with a compound (name, age) index if age is renamed or dropped
|
||||
dogs = fresh_db["dogs"]
|
||||
dogs.insert({"id": 1, "name": "Cleo", "age": 5}, pk="id")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue