migration-scripts icon indicating copy to clipboard operation
migration-scripts copied to clipboard

v3 to v4 script fails when the U&P plugin is not installed

Open fdel-car opened this issue 3 years ago • 3 comments

Bug report

Required System information

  • Node.js version: 16.13.0
  • NPM version: 8.13.2
  • Source Strapi version: 3.6.8
  • Target Strapi version: 4.1.9
  • Source Database: PostgreSQL 12.9
  • Target Database: PostgreSQL 12.9
  • Operating system: WSL2 / Ubuntu 20.04
  • Which script are you running: v3-sql-v4-sql

Describe the bug

If the U&P plugin is missing from the target project, the script will crash.

error: delete from "up_permissions_role_links" - relation "up_permissions_role_links" does not exist

Steps to reproduce the behavior

Pretty straightforward, just try a migration, targeting a project without U&P installed.

Expected behavior

I would expect a warning message explaining that the U&P plugin is probably not installed, and the users' permissions were not migrated. Apart from that everything should work nonetheless.

Or you can choose to stop there and tell the user to add U&P to his/her app but then it implies that U&P is not really a plugin as it's required.

fdel-car avatar Aug 08 '22 14:08 fdel-car

We would likely need to add a special exception here or possibly just build an optional addtional custom migration that would just ignore/delete these during the migration.

@martincapek What are your thoughts here?


for context, in v3 the users-permissions plugin was required, in v4 it's optional and is currently installed by default but in the near future it won't be. I think the main issue here is that the scripts are not "code aware" to see if the plugin is installed on the v4 project since it only looks at the database? Should we just have some .env config options to disable syncing certain build in features like users-permissions, etc?

derrickmehaffy avatar Aug 12 '22 16:08 derrickmehaffy

We can add env variable to disable migration of DISABLE_UP_MIGRATION

martincapek avatar Oct 27 '22 14:10 martincapek

Hi, should be fixed in https://github.com/strapi/migration-scripts/pull/74

martincapek avatar Nov 25 '22 20:11 martincapek