Idempotent per-entity subfolder creation under the matching system root. Fast-path SELECT short-circuits the common case. Inserts race safely via uniq_document_folders_entity (partial unique on port_id+entity_type+entity_id) — the loser re-SELECTs the winner's row. Sibling-name collisions between two entities with the same display name append (2), (3), … to the new folder; existing folders never rename. Exports EntityType for use by downstream tasks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.9 KiB
4.9 KiB