mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-10 10:44:20 +02:00
[feature/migrations] Function effectively_installed() in migrations
Allows you to check if the migration is effectively installed (entirely optionall) This function is intended to help moving to migrations from a previous database updater, where some migrations may have been installed already even though they are not yet listed in the migrations table. PHPBB3-9737
This commit is contained in:
@@ -19,6 +19,7 @@ require_once dirname(__FILE__) . '/migration/recall.php';
|
||||
require_once dirname(__FILE__) . '/migration/revert.php';
|
||||
require_once dirname(__FILE__) . '/migration/revert_with_dependency.php';
|
||||
require_once dirname(__FILE__) . '/migration/fail.php';
|
||||
require_once dirname(__FILE__) . '/migration/installed.php';
|
||||
|
||||
class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||
{
|
||||
@@ -233,4 +234,24 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||
$this->fail('Revert did not remove test_column.');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_installed()
|
||||
{
|
||||
$this->migrator->set_migrations(array('phpbb_dbal_migration_installed'));
|
||||
|
||||
global $migrator_test_installed_failed;
|
||||
$migrator_test_installed_failed = false;
|
||||
|
||||
while (!$this->migrator->finished())
|
||||
{
|
||||
$this->migrator->update();
|
||||
}
|
||||
|
||||
$this->assertTrue($this->migrator->migration_state('phpbb_dbal_migration_installed') !== false);
|
||||
|
||||
if ($migrator_test_installed_failed)
|
||||
{
|
||||
$this->fail('Installed test failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user