19declare(strict_types=1);
41 'show_question_titles',
42 'certificate_visibility',
48 private \ilDBInterface
$db;
53 return 'Remove columns from tst_tests and tst_test_defaults that are now in tst_test_settings';
64 new \ilDatabaseInitializedObjective(),
73 $move_settings->prepare($environment);
74 if ($move_settings->getRemainingAmountOfSteps() > 0) {
75 $this->data_loss_detected =
true;
80 $move_templates->prepare($environment);
81 if ($move_templates->getRemainingAmountOfSteps() > 0) {
82 $this->data_loss_detected =
true;
89 if ($this->data_loss_detected) {
91 'Failed to remove legacy test settings. Please run MoveTestSettingsMigration and MoveSettingsTemplatesMigration first.'
95 $test_columns = array_merge(array_keys(self::SETTINGS_COLUMNS), self::UNUSED_LEGACY_COLUMNS);
96 foreach ($test_columns as $column) {
100 $this->
dropColumn(
'tst_test_defaults',
'marks');
101 $this->
dropColumn(
'tst_test_defaults',
'defaults');
106 return (
int) ($this->db->tableColumnExists(
'tst_tests', array_key_first(self::SETTINGS_COLUMNS))
107 || $this->db->tableColumnExists(
'tst_tests', self::UNUSED_LEGACY_COLUMNS[0])
108 || $this->db->tableColumnExists(
'tst_test_defaults',
'defaults'));
111 private function dropColumn(
string $table,
string $column): void
113 if ($this->db->tableColumnExists($table, $column)) {
114 $this->db->dropTableColumn($table, $column);
Signals that some goal won't be achievable by actions of the system ever.
prepare(Environment $environment)
Prepare the migration by means of some environment.
getDefaultAmountOfStepsPerRun()
Tell the default amount of steps to be executed for one run of the migration.
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
const array UNUSED_LEGACY_COLUMNS
getPreconditions(Environment $environment)
Objectives the migration depend on.
dropColumn(string $table, string $column)
step(Environment $environment)
Run one step of the migration.
An environment holds resources to be used in the setup process.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
A migration is a potentially long lasting operation that can be broken into discrete steps.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...