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

schema (migration step)

Makes or drops a table, a column or an index on every engine through the kernel's schema handlers.

Download as PDF

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

On this page

schema

Makes or drops a table, a column or an index on every engine through the kernel's schema handlers.

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

Modes

mode: is one of create_table, drop_table, add_column, drop_column, add_index, drop_index; every step names one.

Keys

KeyTypeModesDefaultWhat it is
tablestringallrequiredthe table (a collection on MongoDB)
columnsanycreate_table, add_index, drop_indexcreate_table: name => definition (type, length, not_null, default); add_index, drop_index: the columns of the index
primary_keylistcreate_tablethe columns of the primary key
indexesmapcreate_tablename => { columns: [...], unique: bool }
columnstringadd_column, drop_columnrequiredthe column
definitionmapadd_columnrequiredthe column: type, length, not_null, default
indexstringadd_index, drop_indexrequiredthe name of the index
uniquebooladd_indexfalsea unique index

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
changedtrue when the step changed the schema, false when it found its work done

Undoing

Some steps of this type undo themselves when their migration is rolled back without down: (the class says which); a migration with any other step of it needs down: or a rollback to its caption.

It touches no cache.

Example

- type: schema
  mode: add_column
  table: exp_news_rating
  column: created
  definition: { type: int, not_null: true, default: 0 }

Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationstepschemachange.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