Engine with migrations in two places


I’m working on a Rails engine, and I have an issue with migrations: the engine needs a user model but don’t have to provide it. So, I have 3 engine migrations in db/migration, which should be copied over with rails the_engine:install:migrations and a a migration to create the users table in spec/dummy/db/migrations.

Migrating in dev environment is fine and server starts without any issue Migrating in test environment is fine too (no errors, all migrations are applied, checked in schema_migrations table). But when I launch the tests, I have an error about pending migrations, stating that two of the engine migrations are pending

So I tried

  • to add the db/migrations path to ActiveRecord::Migrator.migrations_paths, no result
  • to copy the migrations in spec/dummy/db/migrations, resulting in a ActiveRecord::DuplicateMigrationNameError: error because migrations are duplicated.

I’m a bit stuck as I think that keeping the “dummy” migration separated from the required ones is a good thing, but I run out of ideas for now…