diff options
author | 2018-06-19 13:11:14 +0100 | |
---|---|---|
committer | 2018-06-19 13:11:14 +0100 | |
commit | 1e295d582afc1d151b9ad7d40be3a16c881f9f88 (patch) | |
tree | 374832cd3cea84e180dc094834a5085b9455bda1 /pysite | |
parent | [Jams] Additional logging on teams page (diff) |
[DB] Migration for code_jams to add teams list to all documents
Diffstat (limited to 'pysite')
-rw-r--r-- | pysite/migrations/tables/code_jams/__init__.py | 0 | ||||
-rw-r--r-- | pysite/migrations/tables/code_jams/v1.py | 11 |
2 files changed, 11 insertions, 0 deletions
diff --git a/pysite/migrations/tables/code_jams/__init__.py b/pysite/migrations/tables/code_jams/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/pysite/migrations/tables/code_jams/__init__.py diff --git a/pysite/migrations/tables/code_jams/v1.py b/pysite/migrations/tables/code_jams/v1.py new file mode 100644 index 00000000..cce3b112 --- /dev/null +++ b/pysite/migrations/tables/code_jams/v1.py @@ -0,0 +1,11 @@ +def run(db, table, table_obj): + """ + Add "teams" list to jams without it + """ + + for document in db.get_all(table): + if "teams" not in document: + document["teams"] = [] + + db.insert(table, document, conflict="replace", durability="soft") + db.sync(table) |