Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

sql (migration step)

Runs statements of the engine the installation runs on, written in the step or in files next to the migration.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/examples/migration-steps/sql.md

On this page

sql

Runs statements of the engine the installation runs on, written in the step or in files next to the migration.

A step of a YAML migration with type: sql. The class expMigrationStepSql (kernel/classes/migration/steps/expmigrationstepsql.php) is registered in settings/migration.ini [StepSettings] StepTypeList[sql].

Keys

KeyTypeDefaultWhat it is
sqlstringstatements for every SQL engine (MySQL/MariaDB, PostgreSQL, SQLite, Oracle)
mysqlstringstatements for MySQL/MariaDB (win over sql)
postgresqlstringstatements for PostgreSQL (win over sql)
sqlitestringstatements for SQLite (win over sql)
oraclestringstatements for Oracle (win over sql)
mongodblistcommands for MongoDB: insert, update, delete, create_collection, drop_collection, create_index, drop_index
filestringa file next to the migration; the engine's own file (<name>.<engine>.sql, <name>.mongodb.json) wins over <name>.sql
partstring: up, down"up"the part of the file: up, or down (after a line "-- down")
missingstring: fail, skip"fail"what happens on an engine with no statements: fail or skip

Besides these, every step takes the keys of the engine: type, mode, if, references, environments, engines and comment (the file format). A key of type identifier names a node, an object or another part of the installation by id, remote id, path or name (identifiers).

Values for references

references: { <name>: <value> } keeps a value of the step's result as ${ref.<name>} for the steps and migrations after it:

ValueWhat it is
statementshow many statements or commands ran
enginethe engine they ran on

Undoing

A step of this type does not undo itself: a migration with it needs down: or a rollback to its caption.

It touches no cache.

Example

- type: sql
  sql: "UPDATE ezcontentclass SET always_available = 1 WHERE identifier = 'news';"
  mongodb:
    - { update: ezcontentclass, filter: { identifier: news }, set: { always_available: 1 } }

Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationstepsql.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x