Repository navigation
Check schema references when a change set publishes #2604
Copy link
Copy link
Open
Labels
area:schemaContent types and entity types (SCH)Content types and entity types (SCH)type:featureNew capabilityNew capabilityv2FluentCMS v2 (v2 branch)FluentCMS v2 (v2 branch)
Milestone
Description
Part of #2415 (F-SCH). A follow-up from the review of #2520 (SCH-05).
A content type write checks its references against what each type is heading to: every draft an open set proposes, or the published version while there is none (SCH-04). Sets publish one at a time, though, so a write-time check cannot see the order they will publish in. Two cases still leave a live reference to a field the live target lacks:
- Set A adds
logotobrand. Set B adds apagefield that referencesbrand.logo, which is accepted because the open draft ofbrandhas it. Then B publishes before A, or A is rejected. - A set that adds
logopublishes, and a later set that references it publishes too. Reverting the first set takeslogoaway again (Add change set revert #2511).
Scope
- When a set publishes, check the references against what will be live once it has: those of each schema item the set makes live, and those of every live type that points at an item the set changes. On a failure, nothing is published and the answer names each dangling reference, as the write-time checks do (
reference_field_unknown,reference_target_not_entity,field_referenced). - A revert publishes like any other set, so it gets the same check.
- Let a set drop a field together with the last reference to it. Today the write-time check (
field_referenced) still counts the referencing type's published version when the same set's draft of that type removes the reference. With the check at publish in place, the write-time check can trust that draft.
Out of scope
- References between entries (F-CNT F-CNT: Entries with versions, states and entity references #2416).
- Telling the author at write time which set a referenced field depends on. The desk can show that when it reviews schema (F-DSK F-DSK: Review desk as the home screen #2422).
Acceptance
- In both cases above, the publish that would leave the reference dangling fails. Nothing is published, and the error names the field and the type that references it.
- A set that adds a field and a reference to it publishes, and so does a set that drops a field together with the last reference to it.
- All of the above passes on SQLite and PostgreSQL.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:schemaContent types and entity types (SCH)Content types and entity types (SCH)type:featureNew capabilityNew capabilityv2FluentCMS v2 (v2 branch)FluentCMS v2 (v2 branch)
Activity
Record content type writes as change set operations (#2520)