fix(dn-batches): heal created/updated fields on existing live collections
The earlier commit made the script include these fields for from-scratch creates, but didn't repair the existing live dn_batch_notes collection. The repair path (add_fields) covers that case so re-running the script against an already-deployed PB collection also adds them.
This commit is contained in:
parent
c436422acc
commit
ea0299193d
1 changed files with 13 additions and 0 deletions
|
|
@ -133,6 +133,19 @@ def main():
|
|||
{"name": "page_to", "type": "number", "required": False},
|
||||
])
|
||||
|
||||
# Repair the standard system date fields on both new collections
|
||||
# if they were created before this script knew to include them. The
|
||||
# `create_collection` path only fires for from-scratch creates;
|
||||
# add_fields is the path that heals an existing live collection.
|
||||
add_fields(token, "dn_batches", [
|
||||
{"name": "created", "type": "date", "required": False, "onCreate": True},
|
||||
{"name": "updated", "type": "date", "required": False, "onCreate": True, "onUpdate": True},
|
||||
])
|
||||
add_fields(token, "dn_batch_notes", [
|
||||
{"name": "created", "type": "date", "required": False, "onCreate": True},
|
||||
{"name": "updated", "type": "date", "required": False, "onCreate": True, "onUpdate": True},
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue