mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-16 05:24:26 +02:00
Test for .transform() rowid table to id table
This commit is contained in:
parent
7b8e7c4207
commit
fe7cb7e8aa
1 changed files with 9 additions and 0 deletions
|
|
@ -83,3 +83,12 @@ def test_transform_sql(fresh_db, params, expected_sql):
|
|||
assert sql == expected_sql
|
||||
# Check that .transform() runs without exceptions:
|
||||
dogs.transform(**params)
|
||||
|
||||
|
||||
def test_transform_sql_rowid_to_id(fresh_db):
|
||||
dogs = fresh_db["dogs"]
|
||||
dogs.insert({"id": 1, "name": "Cleo", "age": "5"})
|
||||
assert dogs.schema == 'CREATE TABLE [dogs] (\n [id] INTEGER,\n [name] TEXT,\n [age] TEXT\n)'
|
||||
dogs.transform(pk="id")
|
||||
# Slight oddity: [dogs] becomes "dogs" during the rename:
|
||||
assert dogs.schema == 'CREATE TABLE "dogs" (\n [id] INTEGER PRIMARY KEY,\n [name] TEXT,\n [age] TEXT\n)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue