References

Maintenance Commands

Maintenance commands perform administrative operations on the database and application. They run with full privileges and are available only to admin users. You can execute maintenance commands through the Admin UI (Schema → Admin menu), the REST API (POST /structr/rest/maintenance/<command>), or programmatically using the maintenance() function. For details on execution methods, see the Maintenance chapter.

changeNodePropertyKey

Migrates property values from one property key to another.

Parameters

NameDescriptionOptional
oldKeySource property keyno
newKeyTarget property keyno
typeNode type to migrate. If omitted, all nodes are migrated.yes

Use this command when you rename a property in your schema and need to move existing data to the new key.

clearDatabase

Removes all nodes and relationships from the database.

Notes

copyRelationshipProperties

Copies property values from one key to another on all relationships.

Parameters

NameDescriptionOptional
sourceKeySource property keyno
destKeyDestination property keyno

createLabels

Updates Neo4j type labels on nodes to match their Structr type hierarchy.

Parameters

NameDescriptionOptional
typeLimit to nodes of this typeyes
removeUnusedRemove labels without corresponding types (default: true)yes

Use this command after changing type inheritance or when labels are out of sync.

The command reads each node’s type property, resolves the inheritance hierarchy, and creates a label for each type in the chain.

Notes

deleteSpatialIndex

Removes legacy spatial index nodes from the database.

Deletes all nodes with bbox and gtype properties.

Notes

detachedNodes

Reports (and optionally repairs) DOM nodes that belong to no page.

A DOM node that has no ownerDocument still renders, because rendering walks the parent, so the
application looks healthy. Deployment export walks documents instead - the pages and the
ShadowDocument - so such a node is silently left out of the export, while every page that
references it keeps the reference. The next import then produces empty page shells, and a page
whose root element is such a node fails to import at all.

The command reports three kinds:

It runs as a DRY RUN unless repair=true is passed.

Notes

migrate

Runs the startup migrations, either reporting what they would change or applying them.

Structr migrates data and schema at startup, governed by application.migration.mode. This
command runs the same steps on a running instance, with the mode given as a parameter instead
of read from the configuration.

Two of the steps only ever read and report: the check for notion properties that need attention,
and the report on calls to the HTTP functions that still use the pre-7.0 signature. Those run in
both modes.

The results are written to the server log, not returned to the caller.

Notes

deployData

Exports or imports application data.

Parameters

NameDescriptionOptional
modeimport or exportno
sourceSource folder path (required for import)yes
targetTarget folder path (required for export)yes
typesComma-separated list of types to exportyes

Exports or imports data only, not the schema or application structure. Use this for backing up or migrating data between environments.

deploy

Exports or imports a Structr application without data.

Parameters

NameDescriptionOptional
modeimport or exportno
sourceSource folder path (required for import)yes
targetTarget folder path (required for export)yes
extendExistingAppIf true, import merges with existing application instead of replacing ityes

Exports or imports the schema, pages, files, and security configuration. The export creates a text-based format suitable for version control.

This is the same mechanism used by the Dashboard deployment feature.

directFileImport

Imports files from a server filesystem directory into Structr’s virtual filesystem.

Parameters

NameDescriptionOptional
sourceSource directory path on the serverno
modecopy (keep originals) or move (delete after import)no
existingHandle duplicates: skip, overwrite, or rename (default: skip)yes
indexEnable fulltext indexing for imported files (default: true)yes

Notes

fixNodeProperties

Converts property values that were stored with an incorrect type.

Parameters

NameDescriptionOptional
typeNode type to fixno
nameSpecific property to fix (default: all properties)yes

Use this command after changing a property’s type in the schema, for example from String to Integer.

flushCaches

Clears all internal caches.

Use this command to reduce memory consumption or resolve cache invalidation issues.

letsencrypt

Creates or renews an SSL certificate using Let’s Encrypt.

Parameters

NameDescriptionOptional
serverstaging (test certificates) or production (valid certificates)no
challengeOverride the configured challenge method (http for HTTP-01 validation, dns for DNS-01)yes
waitOverride the configured wait time in seconds before authorizing challengeyes
reloadReload HTTPS certificate without restart (default: false)yes
verboseEnables verbose logging (default: falseyes
keepChallengeFilesEnables keeping the challenge files (default: falseyes

Notes

maintenanceMode

Enables or disables the maintenance mode.

Parameters

NameDescriptionOptional
actionenable or disableno

When the maintenance mode is started, the following services are shut down:

After a short delay, the following services are restarted on different ports:

Notes

rebuildIndex

Rebuilds database indexes by removing and re-adding all indexed properties.

Parameters

NameDescriptionOptional
typeLimit to this node typeyes
relTypeLimit to this relationship typeyes
modenodesOnly or relsOnlyyes

Use this command after bulk imports or when search results are inconsistent.

setNodeProperties

Sets property values on all nodes of a given type.

Parameters

NameDescriptionOptional
typeNode type to modifyno
newTypeNew value for the type propertyyes

All parameters except type and newType are treated as property key-value pairs to set on matching nodes.

Notes

setRelationshipProperties

Sets property values on all relationships of a given type.

Parameters

NameDescriptionOptional
typeRelationship type to modifyno

All parameters except type are treated as property key-value pairs to set on matching relationships.

Notes

setUuid

Generates UUIDs for nodes and relationships that lack an id property.

Parameters

NameDescriptionOptional
typeLimit to this node typeyes
relTypeLimit to this relationship typeyes
allNodesApply to all nodesyes
allRelsApply to all relationshipsyes