Open MercatoDocsSearch docsAPI reference

CLI

mercato entities install

After adding entity or custom-field declarations in a module, synchronize them with the database. Check the installed definition before diagnosing a missing field in a form.

yarn mercato entities install reads custom entity definitions from every enabled module and installs them for the desired scope. It is typically executed after yarn db:migrate or any time module metadata changes.

Usage

yarn mercato entities install [--tenant <tenantId>] [--global] [--no-global] [--dry-run] [--force]

Aliases: --tenantId for --tenant, --dry for --dry-run.

Options

OptionDescription
--tenant <id>Limit synchronization to a single tenant.
--globalProcess only global (tenant-less) definitions. When set, omitting --no-global is recommended.
--no-globalSkip global definitions, applying changes only to tenant-specific entries. Cannot be combined with --global.
--dry-runLog actions without persisting changes. Output stats are prefixed with [dry-run].
--forceReinstall even when definitions appear up to date (useful after manual edits).

Behavior

  1. Resolves the tenant scope based on the provided options.
  2. Calls installCustomEntitiesFromModules, which compares module metadata with stored CustomEntity and CustomFieldDef rows.
  3. Writes updates, additions, or skips unchanged entries. Cache backends (if registered) are notified for invalidation.
  4. Prints a summary: Sync complete: processed=6, updated=2, fieldsChanged=5, skipped=1. When --dry-run is active the prefix becomes Dry-run.

Examples

Install definitions for every tenant plus global scope:

yarn mercato entities install

Dry-run the sync for a specific tenant:

yarn mercato entities install --tenant 81c3b8b0-6f06-44f6-9c22-12c0d9ec3c63 --dry-run

Install only global definitions (no tenant overrides):

yarn mercato entities install --global

Troubleshooting

Previous: mercato entities decrypt-database · Next: Module CLI commands