TonyDeplanque / strapi-plugin-migrations

Init or update your data easly with a version controller.
25 stars 14 forks source link

fn is not a function #7

Open TitusKirch opened 2 years ago

TitusKirch commented 2 years ago

Hey, after installing and copying the example I get the error message:

error: Migration v1_init_user_titles.js (up) failed: Original error: fn is not a function

Anyone have an idea what this could be due to or is this a problem in the plugin?

Best regards Titus

jmleroux commented 2 years ago

Hello, I have the same error on a fresh Strapi 4.3.8 install.

AndreasMaros commented 2 years ago

I encountered the same problem, and I have a hunch:

So apparently Strapi has its own migration suite built-in, using the library umzug, which attempts to read database migrations from a subdirectory migrations in the SQLite database's directory.

umzug expects a different format for migrations: It requires an object containing up() and down() methods.

// umzug migration format
module.exports = {
  asnyc up() {
    // do things
  },
  async down() {
    // undo things
  },
};

This means that in order to use this plugin, you will need to move your migrations and the the configured migrations directory to a different location, where they will not be read by umzug.


The questions, however, that pose themselves are (and maybe @TonyDeplanque can help in answering them):