mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-27 12:24:11 +02:00
Apply Black
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StxDiBxEbsv8VBmqxamgUV
This commit is contained in:
parent
89b3724871
commit
8ca780c30d
1 changed files with 2 additions and 4 deletions
|
|
@ -441,16 +441,14 @@ def test_transform_on_delete_cascade_does_not_delete_records(
|
||||||
# not cascade and delete the referencing records
|
# not cascade and delete the referencing records
|
||||||
if use_pragma_foreign_keys:
|
if use_pragma_foreign_keys:
|
||||||
fresh_db.conn.execute("PRAGMA foreign_keys=ON")
|
fresh_db.conn.execute("PRAGMA foreign_keys=ON")
|
||||||
fresh_db.executescript(
|
fresh_db.executescript("""
|
||||||
"""
|
|
||||||
CREATE TABLE authors (id INTEGER PRIMARY KEY, name TEXT);
|
CREATE TABLE authors (id INTEGER PRIMARY KEY, name TEXT);
|
||||||
CREATE TABLE books (
|
CREATE TABLE books (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
title TEXT,
|
title TEXT,
|
||||||
author_id INTEGER REFERENCES authors(id) ON DELETE CASCADE
|
author_id INTEGER REFERENCES authors(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
"""
|
""")
|
||||||
)
|
|
||||||
fresh_db["authors"].insert({"id": 1, "name": "Ursula K. Le Guin"})
|
fresh_db["authors"].insert({"id": 1, "name": "Ursula K. Le Guin"})
|
||||||
fresh_db["books"].insert({"id": 1, "title": "The Dispossessed", "author_id": 1})
|
fresh_db["books"].insert({"id": 1, "title": "The Dispossessed", "author_id": 1})
|
||||||
# Transform the table on the other end of the cascading foreign key
|
# Transform the table on the other end of the cascading foreign key
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue