Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- An application with empty choice lists is not usable after install.
Why this is needed
- A manager who installs an application from a manifest, a template or a generated app gets empty tables. Lookup tables that relation columns point at (case types, statuses, departments) are empty too, so the first user has nothing to choose and must type the lists in by hand.
- buildiq parity: buildiq's export carries seed data next to the manifest and the register definition (feature comparison, section 6, "Export the application definition": partial in Tables).
- Needed by the ZIP export with data (Export and import an application as a ZIP with its data #3458), by templates that include rows (Save an application as a template and create from it #3457) and by generated apps that ship their lists (Generate an installable app from an application #3461). It needs row uuids (UUIDs for rows #3093) first: the plan puts row uuids before relations by uuid, manifest export and packaging.
Describe the solution you'd like
- The manifest export can include the rows of chosen tables, and the import can load them, so an application can ship with its lists of values or demo data.
Diagram
sequenceDiagram
actor M as Manager
participant API as api/2 manifest routes (new, #3450 and #3451)
participant S as ContextService
participant DB as rows of the chosen tables
M->>API: export, with the list of tables whose rows go along
API->>S: build the manifest
S->>DB: read the rows in the object shape (3096)
S-->>M: manifest with rows, relation cells as row uuids
M->>API: import the manifest on another instance
API->>S: look up each row by its uuid
S->>DB: insert the rows whose uuid is missing
S->>DB: leave rows with a known uuid alone
Acceptance Criteria
- Export takes a list of tables whose rows are included.
- Rows are written in the object shape (Option to return rows as objects and accept object-shape writes to API/2 #3096), with relations by row uuid (UUIDs for rows #3093).
- Import inserts rows that are missing by uuid and leaves existing rows alone.
- Unit tests.
- The route declares its permission with
#[RequirePermission]using a fixed node type, and the service checks the same right (create rows on every target table) before it inserts; a test runs every write as a reader and expects 403 (or 404 where the reader may not know the object exists). - The export holds only rows the exporting user may read.
Out of scope
- Updating or deleting existing rows on import: only missing rows are inserted. A later option can follow, see the questions.
- The files of file columns: the ZIP of Export and import an application as a ZIP with its data #3458.
- Links of Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468 between rows: a later addition to the manifest.
- Proposed slicing: one PR for rows in the export, then one for the import, in that order.
Describe alternatives you've considered
Questions for maintainers
- What happens on import when a row with the same uuid exists but its values differ? (a) leave it alone, (b) overwrite it, (c) an explicit option on the import. We would go with (a) by default and (c) later, because an import must not overwrite data users changed.
- Which tables ship their rows? (a) a list passed on each export call, (b) a flag stored on the table inside the application. We would go with (a), because it needs no new stored field; templates (Save an application as a template and create from it #3457) can add (b) if they need it.
- Rows use the object shape of Option to return rows as objects and accept object-shape writes to API/2 #3096, keyed by the column's technical name. Should relation cells inside the manifest name their target by row uuid (as drafted) or by a label value? We would go with the uuid, because labels are not unique.
Additional context
Linking to other objects
- This issue touches rows: it writes them into the manifest and reads them back on import.
- Today a relation cell stores the id of the target row, which differs per instance; import and export remapping of relations is part of Relations: filter, sort, inverse lookups, inline resolve, import and export #3347. A link column cell stores a URL, which still points at the exporting instance after import. Links as proposed in Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468 are not carried across instances in v1, because their ids are instance-local.
- What this issue must do so rows can take part in linking later: key every exported row by its uuid (UUIDs for rows #3093, PR feat(rows): add persistent UUIDv7 identifiers to rows #3229) inside the manifest only, on the dedicated manifest export and import endpoints; inside the instance rows keep their ids, as agreed on UUIDs for rows #3093; write relation cells as the target row's uuid and resolve them on import, and leave room in the manifest for links between two rows that are both in the manifest, written as a pair of row uuids.
Relevant files:
Related issues
- depends on UUIDs for rows #3093, Option to return rows as objects and accept object-shape writes to API/2 #3096
Drafted with AI assistance from the project plan; @rjzondervan reviews it. Part of #3419.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity