1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
10
|
|
|
use Doctrine\DBAL\Schema\Schema; |
11
|
|
|
|
12
|
|
|
final class Version20251001221600 extends AbstractMigrationChamilo |
13
|
|
|
{ |
14
|
|
|
public function getDescription(): string |
15
|
|
|
{ |
16
|
|
|
return 'Migration to drop unused tables and ensure schema consistency.'; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function up(Schema $schema): void |
20
|
|
|
{ |
21
|
|
|
// Disable foreign key checks to prevent issues during migration |
22
|
|
|
$this->addSql('SET FOREIGN_KEY_CHECKS = 0;'); |
23
|
|
|
|
24
|
|
|
// Drop tables if they exist |
25
|
|
|
$tablesToDrop = [ |
26
|
|
|
'page__snapshot', |
27
|
|
|
'class_item', |
28
|
|
|
'classification__collection', |
29
|
|
|
'c_userinfo_def', |
30
|
|
|
'class_user', |
31
|
|
|
'faq_question', |
32
|
|
|
'timeline__component', |
33
|
|
|
'page__page', |
34
|
|
|
'c_online_connected', |
35
|
|
|
'c_permission_task', |
36
|
|
|
'page__bloc', |
37
|
|
|
'c_online_link', |
38
|
|
|
'c_permission_user', |
39
|
|
|
'c_role_user', |
40
|
|
|
'c_role', |
41
|
|
|
'page__site', |
42
|
|
|
'shared_survey', |
43
|
|
|
'media__gallery', |
44
|
|
|
'faq_category', |
45
|
|
|
'classification__context', |
46
|
|
|
'timeline__timeline', |
47
|
|
|
'classification__category', |
48
|
|
|
'faq_question_translation', |
49
|
|
|
'c_userinfo_content', |
50
|
|
|
'contact_category', |
51
|
|
|
'classification__tag', |
52
|
|
|
'faq_category_translation', |
53
|
|
|
'timeline__action_component', |
54
|
|
|
'media__media', |
55
|
|
|
'c_role_permissions', |
56
|
|
|
'shared_survey_question_option', |
57
|
|
|
'shared_survey_question', |
58
|
|
|
'timeline__action', |
59
|
|
|
'contact_category_translation', |
60
|
|
|
'media__gallery_media', |
61
|
|
|
'c_item_property', |
62
|
|
|
'c_survey_group', |
63
|
|
|
'c_permission_group', |
64
|
|
|
'c_role_group', |
65
|
|
|
'track_e_open', |
66
|
|
|
]; |
67
|
|
|
|
68
|
|
|
foreach ($tablesToDrop as $table) { |
69
|
|
|
// Check if the table exists before attempting to drop it |
70
|
|
|
if ($schema->hasTable($table)) { |
71
|
|
|
$this->addSql("DROP TABLE $table;"); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
// Re-enable foreign key checks |
76
|
|
|
$this->addSql('SET FOREIGN_KEY_CHECKS = 1;'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function down(Schema $schema): void {} |
80
|
|
|
} |
81
|
|
|
|