Coverage for app/updates/_003_add_word_count.py: 100%
6 statements
« prev ^ index » next coverage.py v7.9.2, created at 2026-02-19 12:47 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2026-02-19 12:47 +0000
1# app/updates/_003_add_word_count.py
2from neo4j import ManagedTransaction
4ID = 3
5DESCRIPTION = "Backfill word_count"
7def upgrade(tx: ManagedTransaction) -> None:
8 # Nodes
9 tx.run("""
10 MATCH (n)
11 WHERE n.word_count IS NULL
12 SET n.word_count = coalesce(n.word_count, -1)
13 """)
15 # Relationships
16 tx.run("""
17 MATCH ()-[r]->()
18 WHERE r.word_count IS NULL
19 SET r.word_count = coalesce(r.word_count, -1)
20 """)