From ea0299193da52056e02863f199cbe4d9a9dc083e Mon Sep 17 00:00:00 2001 From: DEls Date: Thu, 17 Sep 2026 15:17:17 +0200 Subject: [PATCH] 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. --- scripts/pb-add-dn-batches.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/pb-add-dn-batches.py b/scripts/pb-add-dn-batches.py index 98cfbf7..a440144 100755 --- a/scripts/pb-add-dn-batches.py +++ b/scripts/pb-add-dn-batches.py @@ -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()