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

Support regular contentful-migrations migration syntax #31

Open
deluan opened this issue Sep 11, 2019 · 0 comments
Open

Support regular contentful-migrations migration syntax #31

deluan opened this issue Sep 11, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@deluan
Copy link
Owner

deluan commented Sep 11, 2019

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");
@deluan deluan added enhancement New feature or request good first issue Good for newcomers and removed good first issue Good for newcomers labels Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant