Skip to content

fix: standardise on CREATE OR MODIFY — remove/deprecate CREATE OR REPLACE variants #510

@ako

Description

@ako

Background

Two upsert variants exist in MDL:

  • CREATE OR MODIFY — updates the existing document in-place, preserving its UUID/ID. References from other documents (navigation, microflow calls, page references) remain intact.
  • CREATE OR REPLACE — deletes the existing document and creates a new one with a fresh UUID. This silently breaks any in-project reference to the old UUID.

Problem

CREATE OR REPLACE is actively unsafe for any document that is referenced from elsewhere in the project. A page replaced this way gets a new ID; any microflow with a show page action targeting the old ID becomes a dangling reference that only surfaces when Studio Pro opens the file.

Additionally, the error message on plain CREATE MICROFLOW currently reads:

microflow 'Module.Name' already exists (use create or replace to overwrite)

This steers users toward the unsafe variant. Microflows don't even have CREATE OR REPLACE syntax — only CREATE OR MODIFY — so the message is both misleading and wrong.

Proposed change

  1. Standardise on CREATE OR MODIFY as the idempotent upsert for all document types. Where a type currently only has CREATE OR REPLACE (JSON structure, image collection, published REST service, business event service), add CREATE OR MODIFY and consider deprecating OR REPLACE.
  2. Fix the error message in cmd_microflows_create.go to say use create or modify to overwrite instead of use create or replace.
  3. Document the distinction in MDL_QUICK_REFERENCE.md and the relevant skill files: OR MODIFY preserves UUID (safe for referenced documents), OR REPLACE does not (avoid unless the document is guaranteed unreferenced).

Affected files

  • mdl/executor/cmd_microflows_create.go — misleading error message (line ~73)
  • Grammar and executor for types that only have OR REPLACE: JSON structure, image collection, published REST service, business event service
  • docs/01-project/MDL_QUICK_REFERENCE.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions