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:
DEls 2026-09-17 15:17:17 +02:00
parent c436422acc
commit ea0299193d

View file

@ -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()