Skip to content

Commit 9100a93

Browse files
Internal: Add migration to remove show_conditions_to_user and gdpr/my_terms extra fields
1 parent 92a8998 commit 9100a93

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
declare(strict_types=1);
6+
7+
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8+
9+
use Chamilo\CoreBundle\Entity\ExtraField;
10+
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
11+
use Doctrine\DBAL\Schema\Schema;
12+
13+
final class Version20250724115010 extends AbstractMigrationChamilo
14+
{
15+
public function getDescription(): string
16+
{
17+
return 'Remove show_conditions_to_user setting and gdpr + my_terms extra_fields';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
$this->addSql("DELETE FROM settings WHERE variable = 'show_conditions_to_user'");
23+
24+
$userType = ExtraField::USER_FIELD_TYPE;
25+
$this->addSql("
26+
DELETE FROM extra_field_values
27+
WHERE field_id IN (
28+
SELECT id FROM extra_field
29+
WHERE item_type = $userType
30+
AND variable IN ('gdpr','my_terms')
31+
)
32+
");
33+
34+
$this->addSql("
35+
DELETE FROM extra_field
36+
WHERE item_type = $userType
37+
AND variable IN ('gdpr','my_terms')
38+
");
39+
}
40+
41+
public function down(Schema $schema): void {}
42+
}

0 commit comments

Comments
 (0)