1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
6
|
|
|
|
7
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
8
|
|
|
use Doctrine\DBAL\Schema\Schema; |
9
|
|
|
|
10
|
|
|
final class Version20240114174300 extends AbstractMigrationChamilo |
11
|
|
|
{ |
12
|
|
|
public function getDescription(): string |
13
|
|
|
{ |
14
|
|
|
return 'Replace "name" with "title" fields in tables (part 2)'; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public function up(Schema $schema): void |
18
|
|
|
{ |
19
|
|
|
if ($schema->hasTable('skill_level')) { |
20
|
|
|
$this->addSql( |
21
|
|
|
'ALTER TABLE skill_level CHANGE short_name short_title VARCHAR(255) NOT NULL' |
22
|
|
|
); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
if ($schema->hasTable('c_chat_conversation')) { |
26
|
|
|
$this->addSql( |
27
|
|
|
'ALTER TABLE c_chat_conversation CHANGE name title VARCHAR(255) NOT NULL' |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
if ($schema->hasTable('c_wiki_category')) { |
32
|
|
|
$this->addSql( |
33
|
|
|
'ALTER TABLE c_wiki_category CHANGE name title VARCHAR(255) NOT NULL' |
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
if ($schema->hasTable('c_shortcut')) { |
38
|
|
|
$this->addSql( |
39
|
|
|
'ALTER TABLE c_shortcut CHANGE name title VARCHAR(255) NOT NULL' |
40
|
|
|
); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
if ($schema->hasTable('illustration')) { |
44
|
|
|
$this->addSql( |
45
|
|
|
'ALTER TABLE illustration CHANGE name title VARCHAR(255) NOT NULL' |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if ($schema->hasTable('resource_type')) { |
50
|
|
|
$this->addSql( |
51
|
|
|
'ALTER TABLE resource_type CHANGE name title VARCHAR(255) NOT NULL' |
52
|
|
|
); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
if ($schema->hasTable('resource_format')) { |
56
|
|
|
$this->addSql( |
57
|
|
|
'ALTER TABLE resource_format CHANGE name title VARCHAR(255) NOT NULL' |
58
|
|
|
); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
if ($schema->hasTable('tool')) { |
62
|
|
|
$table = $schema->getTable('tool'); |
63
|
|
|
if ($table->hasIndex('UNIQ_20F33ED15E237E06')) { |
64
|
|
|
$this->addSql( |
65
|
|
|
'DROP INDEX UNIQ_20F33ED15E237E06 on tool' |
66
|
|
|
); |
67
|
|
|
} |
68
|
|
|
$this->addSql( |
69
|
|
|
'ALTER TABLE tool CHANGE name title VARCHAR(255) NOT NULL' |
70
|
|
|
); |
71
|
|
|
$this->addSql( |
72
|
|
|
'CREATE UNIQUE INDEX UNIQ_20F33ED12B36786B ON tool (title)' |
73
|
|
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
if ($schema->hasTable('resource_tag')) { |
77
|
|
|
$this->addSql( |
78
|
|
|
'ALTER TABLE resource_tag CHANGE name title VARCHAR(255) NOT NULL' |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
if ($schema->hasTable('track_e_hotpotatoes')) { |
83
|
|
|
$this->addSql( |
84
|
|
|
'ALTER TABLE track_e_hotpotatoes CHANGE exe_name title VARCHAR(255) NOT NULL' |
85
|
|
|
); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
if ($schema->hasTable('lti_external_tool')) { |
89
|
|
|
$this->addSql( |
90
|
|
|
'ALTER TABLE lti_external_tool CHANGE name title VARCHAR(255) NOT NULL' |
91
|
|
|
); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function down(Schema $schema): void |
97
|
|
|
{ |
98
|
|
|
|
99
|
|
|
$table = $schema->getTable('lti_external_tool'); |
100
|
|
|
if ($table->hasColumn('title')) { |
101
|
|
|
$this->addSql('ALTER TABLE lti_external_tool CHANGE title name VARCHAR(255) NOT NULL'); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
$table = $schema->getTable('track_e_hotpotatoes'); |
105
|
|
|
if ($table->hasColumn('title')) { |
106
|
|
|
$this->addSql('ALTER TABLE track_e_hotpotatoes CHANGE title exe_name VARCHAR(255) NOT NULL'); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
$table = $schema->getTable('resource_tag'); |
110
|
|
|
if ($table->hasColumn('title')) { |
111
|
|
|
$this->addSql('ALTER TABLE resource_tag CHANGE title name VARCHAR(255) NOT NULL'); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
$table = $schema->getTable('tool'); |
115
|
|
|
if ($table->hasIndex('UNIQ_20F33ED12B36786B')) { |
116
|
|
|
$this->addSql( |
117
|
|
|
'DROP INDEX UNIQ_20F33ED12B36786B on tool' |
118
|
|
|
); |
119
|
|
|
} |
120
|
|
|
if ($table->hasColumn('title')) { |
121
|
|
|
$this->addSql('ALTER TABLE tool CHANGE title name VARCHAR(255) NOT NULL'); |
122
|
|
|
} |
123
|
|
|
$this->addSql( |
124
|
|
|
'CREATE UNIQUE INDEX UNIQ_20F33ED15E237E06 ON tool (title)' |
125
|
|
|
); |
126
|
|
|
|
127
|
|
|
$table = $schema->getTable('resource_format'); |
128
|
|
|
if ($table->hasColumn('title')) { |
129
|
|
|
$this->addSql('ALTER TABLE resource_format CHANGE title name VARCHAR(255) NOT NULL'); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
$table = $schema->getTable('resource_type'); |
133
|
|
|
if ($table->hasColumn('title')) { |
134
|
|
|
$this->addSql('ALTER TABLE resource_type CHANGE title name VARCHAR(255) NOT NULL'); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
$table = $schema->getTable('illustration'); |
138
|
|
|
if ($table->hasColumn('title')) { |
139
|
|
|
$this->addSql('ALTER TABLE illustration CHANGE title name VARCHAR(255) NOT NULL'); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
$table = $schema->getTable('c_shortcut'); |
143
|
|
|
if ($table->hasColumn('title')) { |
144
|
|
|
$this->addSql('ALTER TABLE c_shortcut CHANGE title name VARCHAR(255) NOT NULL'); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
$table = $schema->getTable('c_wiki_category'); |
148
|
|
|
if ($table->hasColumn('title')) { |
149
|
|
|
$this->addSql('ALTER TABLE c_wiki_category CHANGE title name VARCHAR(255) NOT NULL'); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
$table = $schema->getTable('c_chat_conversation'); |
153
|
|
|
if ($table->hasColumn('title')) { |
154
|
|
|
$this->addSql('ALTER TABLE c_chat_conversation CHANGE title name VARCHAR(255) NOT NULL'); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
$table = $schema->getTable('skill_level'); |
158
|
|
|
if ($table->hasColumn('short_title')) { |
159
|
|
|
$this->addSql('ALTER TABLE skill_level CHANGE short_title short_name VARCHAR(255) NOT NULL'); |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|