Migration Text File

If you need to modify a migration, then use ‘migration generate’ to create the initial migration plan. Then copy the steps into a text file, where you can edit the migration steps.

To run the new migration plan, use “migration run path” where path is the path to your text file.

Migration Text File Format

The text file has a set of migration steps, one per line. Any line beginning with “#” is a comment line and is ignored. Blank lines are ignored.

CommandShort FormExample
create-table typeNameCreates a database table called typeName that represents that Delia type.create-table Customer
delete-table typeNameDeletes a database table called typeName because it is no longer a Delia type that you need.delete-table Customer
rename-table oldTypeName newTypeNameRenames a database table from oldTypeName to newTypeName, because the equivalent Delia type has been renamed.rename-table Customer Customers
add-field typeName.fieldNameAlter the database table typeName to add a field called fieldName.add-field Customer.loyaltyPoints
delete-field typeName.fieldNameAlter the database table typeName to delete a field called fieldName.delete-field Customer.loyaltyPoints
rename-field typeName.oldFieldName newFieldNameRenames a field in database table typeName from oldFieldName to newFieldName, because the equivalent Delia field has been renamed.rename-field Customer.firstName fName
alter-field typeName.fieldNameAlter the attributes of field fieldName in database table typeName. The equivalent Delia field has changed its modifiers. For example if the field has been modified to add an “optional” field modifier.alter Customer.firstName

Example: Here is a sample migration file that adds two fields to Customer and creates a UserProfile table.

Note that the migration file does not need to specify details about the schema changes, since the Delia types already contain all the informatin needed for generating the database schema.

 # this is a comment
 add-field Customer.loyaltyPoints
 add-field Customer.creditScore
 add-table UserProfile