Engineer Migrations


About Migrations

Engineer uses migrations to track configuration changes made to SharePoint. You can use migrations to create a queue of tasks that are executed in order on any number of target environments. Think of migrations as source control for your configuration operations.

Creating Migrations

Use the make command to create new migration files. Once created, you can use Engineer’s migration API to create fields, content types, lists, views, and more.

Using the Migration API

Migration files are JavaScript files that consist of an up and down method. Tasks defined in the up method will be executed during migrate operations. Tasks defined in the down method will be executed during rollback operations. This allows you to define a queue of tasks that are executed during both deployment and retraction of each migration.

Each of these methods passes a single parameter called engineer through to your migration logic. You can use this engineer object to access the migration API.

up(engineer) {
// Add a new list
engineer.web.lists.add('My List');

// Add a new field to the list
engineer.web.lists.getByTitle('My List').fields.add('My New Field');
}

The same API is accessed in both the up and down methods. There are a variety of API endpoints, options, and configurations you can use to do just about anything within your SharePoint environments. Refer to the individual API documentation for more information on how to use each endpoint.

To learn more, we recommend starting with the Web documentation, as all Engineer tasks must begin with a Web.

The Migration Queue

Migration operations are executed in queue, with tasks being performed one at a time in the order they appear within the file. Traditional worries concerning ansynchronous JavaScript state management do not apply, as this is all sorted out in the internal Engineer API queue logic.