aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/migrations/tables/wiki/v1.py
blob: 226703427150d1ff17eb3fb987eb0d60a39eb985 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
def run(db, table, table_obj):
    """
    Ensure that there are no wiki articles that don't have titles
    """

    for document in db.pluck(table, table_obj.primary_key, "title"):
        if not document.get("title"):
            document["title"] = "No Title"

            db.insert(table, document, conflict="update", durability="soft")
    db.sync(table)