#
migrate
:
Custom Migrations
#
Introduction
Rocket CLI utilizes contentful-migration to provide the ability to migrate custom content types.
#
Usage
#
Step 1: Add files
Create a custom-migrations
directory in your project folder.
Add your .ts
migration files to the custom-migrations
directory.
The files should be named in the following format: number-name.ts
.
is used to determine the order of the migrations. The name is used to identify the migration.
example: 001-create-content-type.ts
#
Step 2: Run migration
Run the following command:
rocket contentful migrate
#
Step 3: Select space
Select the space you want to migrate.
If you need a CMA token, have a look in the contentful-add/step-3 documentation.
#
Step 4: Select environment
Select the environment within the selected space.
#
Step 5: Migrate
Rocket CLI will ask you to confirm the migration.
After confirming, the migration starts. Rocket CLI informs you about the success status of the migration.
#
Migration structure
The migration files should be written in the following format:
module.exports = function (migration, context) {
const dog = migration.createContentType("dog");
const name = dog.createField("name");
name.type("Symbol").required(true);
};
For more information about the migration structure, see this Contentful migration documentation.