Fix migrations from 1.9 to 1.11

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent cc2494593e
commit 0c0bb08608
  1. 9
      app/Migrations/Schema/V111/Version111.php
  2. 27
      app/Migrations/Schema/V111/Version20160330103045.php
  3. 10
      main/install/index.php

@ -278,14 +278,19 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_link_ticket_notification', 'true', 'Yes'), ('show_link_ticket_notification', 'false', 'No')");
$this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)");
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)");
$table = $schema->getTable('c_quiz_answer');
$hasIndex = $table->hasIndex('idx_cqa_q');
if (!$hasIndex) {
$this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)");
}
$this->addSql("ALTER TABLE c_student_publication ADD INDEX idx_csp_u (user_id)");
$this->addSql('ALTER TABLE legal MODIFY COLUMN language_id INT NOT NULL');
$this->addSql('ALTER TABLE legal MODIFY COLUMN legal_id INT NOT NULL');
$this->addSql('ALTER TABLE legal DROP PRIMARY KEY;');
$this->addSql('ALTER TABLE legal ADD id INT');
$this->addSql('UPDATE legal SET id = legal_id');
$this->addSql('UPDATE legal SET id = 1 WHERE id = 0');
$this->addSql('ALTER TABLE legal MODIFY COLUMN language_id INT NOT NULL');
$this->addSql('ALTER TABLE legal DROP legal_id');
$this->addSql('ALTER TABLE legal CHANGE id id INT AUTO_INCREMENT NOT NULL PRIMARY KEY;');

@ -109,11 +109,30 @@ class Version20160330103045 extends AbstractMigrationChamilo
//$this->addSql("CREATE UNIQUE INDEX UNIQ_8D93D649A0D96FBF ON user (email_canonical);");
*/
$this->addSql('DROP TABLE extra_field_saved_search');
$this->addSql('DROP INDEX user_sco_course_sv_stack ON track_stored_values_stack');
$this->addSql('ALTER TABLE session_rel_user ADD duration INT DEFAULT NULL');
$this->addSql('DROP INDEX user_sco_course_sv ON track_stored_values');
$table = $schema->getTable('track_stored_values_stack');
$hasIndex = $table->hasIndex('user_sco_course_sv_stack');
if ($hasIndex) {
$this->addSql('DROP INDEX user_sco_course_sv_stack ON track_stored_values_stack');
}
$table = $schema->getTable('session_rel_user');
$hasColumn = $table->hasColumn('duration');
if (!$hasColumn) {
$this->addSql('ALTER TABLE session_rel_user ADD duration INT DEFAULT NULL');
}
$table = $schema->getTable('track_stored_values');
$hasIndex = $table->hasIndex('user_sco_course_sv');
if ($hasIndex) {
$this->addSql('DROP INDEX user_sco_course_sv ON track_stored_values');
}
$table = $schema->getTable('user');
$hasIndex = $table->hasIndex('UNIQ_8D93D649F85E0677');
if ($hasIndex) {
$this->addSql('DROP INDEX UNIQ_8D93D649F85E0677 ON user');
}
$this->addSql('DROP INDEX UNIQ_8D93D649F85E0677 ON user');
$this->addSql(
'ALTER TABLE user ADD email_canonical VARCHAR(255) NOT NULL, ADD credentials_expired TINYINT(1), ADD credentials_expire_at DATETIME DEFAULT NULL, ADD locked TINYINT(1),ADD enabled TINYINT(1) NOT NULL, ADD expired TINYINT(1) NOT NULL, ADD expires_at DATETIME DEFAULT NULL, CHANGE username username VARCHAR(255) NOT NULL, CHANGE username_canonical username_canonical VARCHAR(255) NOT NULL, CHANGE email email VARCHAR(255) NOT NULL'
);

@ -682,6 +682,9 @@ if (@$_POST['step2']) {
error_log('Starting migration process from '.$my_old_version.' ('.date('Y-m-d H:i:s').')');
echo '<a class="btn btn-default" href="javascript:void(0)" id="details_button">'.get_lang('Details').'</a><br />';
echo '<div id="details" style="display:none">';
switch ($my_old_version) {
case '1.9.0':
case '1.9.2':
@ -705,15 +708,12 @@ if (@$_POST['step2']) {
Database::query("ALTER TABLE c_document MODIFY COLUMN filetype char(10) NOT NULL default 'file'");
Database::query("ALTER TABLE c_student_publication MODIFY COLUMN filetype char(10) NOT NULL default 'file'");
echo '<a class="btn btn-default" href="javascript:void(0)" id="details_button">'.get_lang('Details').'</a><br />';
echo '<div id="details" style="display:none">';
// Migrate using the migration files located in:
// src/Chamilo/CoreBundle/Migrations/Schema/V110
$result = migrate(
110,
$manager
);
echo '</div>';
if ($result) {
error_log('Migrations files were executed.');
@ -757,15 +757,12 @@ if (@$_POST['step2']) {
case '1.10.4':
// no break
case '1.10.6':
echo '<a class="btn btn-default" href="javascript:void(0)" id="details_button">'.get_lang('Details').'</a><br />';
echo '<div id="details" style="display:none">';
// Migrate using the migration files located in:
// src/Chamilo/CoreBundle/Migrations/Schema/V111
$result = migrate(
111,
$manager
);
echo '</div>';
if ($result) {
error_log('Migrations files were executed.');
@ -778,6 +775,7 @@ if (@$_POST['step2']) {
default:
break;
}
echo '</div>';
} else {
set_file_folder_permissions();

Loading…
Cancel
Save