reorder_visible_foreign_keys
Reorder related tables in a context's visible foreign key list by index or exact key references, with changes staged until apply_annotations().
Instructions
Reorder foreign keys in the visible-foreign-keys list for a specific context.
This is a convenience tool for reordering related tables without manually reconstructing the list. Changes are staged until apply_annotations() is called.
Args: table_name: Name of the table. context: The context to modify (e.g., "detailed", "*"). new_order: The new order specification. Can be: - List of indices: [2, 0, 1] reorders by current positions - List of foreign key refs: [["schema", "fkey1"], ...] specifies exact order
Returns: JSON with the reordered foreign key list for the context.
Examples: # Reorder by indices (move item at index 2 to front) reorder_visible_foreign_keys("Subject", "detailed", [2, 0, 1])
# Reorder by specifying exact foreign key order
reorder_visible_foreign_keys("Subject", "detailed", [
["domain", "Diagnosis_Subject_fkey"],
["domain", "Image_Subject_fkey"]
])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | Yes | ||
| new_order | Yes | ||
| table_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |