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
| Key | Type | Modes | Default | What it is |
|---|---|---|---|---|
table | string | all | required | the table (a collection on MongoDB) |
columns | any | create_table, add_index, drop_index | create_table: name => definition (type, length, not_null, default); add_index, drop_index: the columns of the index | |
primary_key | list | create_table | the columns of the primary key | |
indexes | map | create_table | name => { columns: [...], unique: bool } | |
column | string | add_column, drop_column | required | the column |
definition | map | add_column | required | the column: type, length, not_null, default |
index | string | add_index, drop_index | required | the name of the index |
unique | bool | add_index | false | a 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:
| Value | What it is |
|---|---|
changed | true 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 }Related
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.