|
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 Version20170524110000 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('track_e_hotpotatoes')) { |
|
38
|
|
|
$this->addSql( |
|
39
|
|
|
'ALTER TABLE track_e_hotpotatoes CHANGE exe_name title VARCHAR(255) NOT NULL' |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
if ($schema->hasTable('fos_group')) { |
|
44
|
|
|
$this->addSql( |
|
45
|
|
|
'ALTER TABLE fos_group CHANGE name title VARCHAR(255) NOT NULL' |
|
46
|
|
|
); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function down(Schema $schema): void |
|
51
|
|
|
{ |
|
52
|
|
|
$table = $schema->getTable('track_e_hotpotatoes'); |
|
53
|
|
|
if ($table->hasColumn('title')) { |
|
54
|
|
|
$this->addSql('ALTER TABLE track_e_hotpotatoes CHANGE title exe_name VARCHAR(255) NOT NULL'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$table = $schema->getTable('tool'); |
|
58
|
|
|
if ($table->hasIndex('UNIQ_20F33ED12B36786B')) { |
|
59
|
|
|
$this->addSql( |
|
60
|
|
|
'DROP INDEX UNIQ_20F33ED12B36786B on tool' |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
if ($table->hasColumn('title')) { |
|
64
|
|
|
$this->addSql('ALTER TABLE tool CHANGE title name VARCHAR(255) NOT NULL'); |
|
65
|
|
|
} |
|
66
|
|
|
$this->addSql( |
|
67
|
|
|
'CREATE UNIQUE INDEX UNIQ_20F33ED15E237E06 ON tool (title)' |
|
68
|
|
|
); |
|
69
|
|
|
|
|
70
|
|
|
$table = $schema->getTable('c_wiki_category'); |
|
71
|
|
|
if ($table->hasColumn('title')) { |
|
72
|
|
|
$this->addSql('ALTER TABLE c_wiki_category CHANGE title name VARCHAR(255) NOT NULL'); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
$table = $schema->getTable('c_chat_conversation'); |
|
76
|
|
|
if ($table->hasColumn('title')) { |
|
77
|
|
|
$this->addSql('ALTER TABLE c_chat_conversation CHANGE title name VARCHAR(255) NOT NULL'); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
$table = $schema->getTable('skill_level'); |
|
81
|
|
|
if ($table->hasColumn('short_title')) { |
|
82
|
|
|
$this->addSql('ALTER TABLE skill_level CHANGE short_title short_name VARCHAR(255) NOT NULL'); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|