diff --git a/tests/auto/functional/tom/migrate/tst_migrate.cpp b/tests/auto/functional/tom/migrate/tst_migrate.cpp index 218d47103..15715d3c0 100644 --- a/tests/auto/functional/tom/migrate/tst_migrate.cpp +++ b/tests/auto/functional/tom/migrate/tst_migrate.cpp @@ -77,9 +77,11 @@ private Q_SLOTS: /*! Prepare arguments and invoke runCommand(). */ [[nodiscard]] static int invokeCommand(const QString &connection, const QString &name, - const std::vector &arguments = {}); + const std::vector &arguments = {}, + const QString &migrationTable = MigrationsTable); /*! Create a tom application instance and invoke the given command. */ - static int runCommand(int &argc, const std::vector &argv); + static int runCommand(int &argc, const std::vector &argv, + const QString &migrationTable); /*! Invoke the status command to obtain results. */ inline static int invokeTestStatusCommand(const QString &connection); @@ -96,8 +98,10 @@ private Q_SLOTS: /*! Throw if the environment is production because it needs confirmation. */ static void throwIfWrongEnvironment(const char *environmentEnvName); - /*! Migrations table name. */ + /*! Migrations table name (used by this test case). */ inline static const auto MigrationsTable = sl("migrations_unit_testing"); + /*! Migrations table name (to cleanup the tom example migrations only). */ + inline static const auto MigrationsTomTable = sl("migrations_example"); /*! Created database connections (needed by the cleanupTestCase()). */ QStringList m_connections; @@ -766,7 +770,8 @@ void tst_Migrate::refresh_Step_StepMigrate() const /* private */ int tst_Migrate::invokeCommand(const QString &connection, const QString &name, - const std::vector &arguments) + const std::vector &arguments, + const QString &migrationTable) { static const auto connectionTmpl = sl("--database=%1"); @@ -791,10 +796,11 @@ int tst_Migrate::invokeCommand(const QString &connection, const QString &name, int argc = static_cast(argv.size()); - return runCommand(argc, argv); + return runCommand(argc, argv, migrationTable); } -int tst_Migrate::runCommand(int &argc, const std::vector &argv) +int tst_Migrate::runCommand(int &argc, const std::vector &argv, + const QString &migrationTable) { // Current environment variable name const auto *const environmentEnvName = "TOM_TESTS_ENV"; @@ -806,7 +812,7 @@ int tst_Migrate::runCommand(int &argc, const std::vector &argv) // env. should be always local or development return TomApplication(argc, const_cast(argv.data()), Databases::managerShared(), environmentEnvName, - MigrationsTable) + migrationTable) .migrations