Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

Support regular contentful-migrations migration syntax #31

@deluan

Description

@deluan

This tool should be able to run scripts meant to be used directly by Contentful's migration tool, i.e. without up and down, only exporting a function.

It could auto-detect that the migrations file is exporting a single function, and consider that as a up, creating a dynamic no-op down, and a auto-generated description (based on the file name.

As an example, a script like this (from Contentful's migration tool README:

module.exports = function (migration, context) {
  const dog = migration.createContentType('dog');
  const name = dog.createField('name');
  name.type('Symbol').required(true);
};

would be behave as if it was something like this:

module.exports.description = <filename>;

module.exports.up = (migration, context) => {
  const dog = migration.createContentType('dog');
  const name = dog.createField('name');
  name.type('Symbol').required(true);
};

module.exports.down = () => throw new Error('down migration is not available");

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions