Internal: Rename track_e_attempt_recording to track_e_attempt_qualify to improve understandability of purpose (#5072)
Author: Christian <christian1827@gmail.com>pull/5076/head
parent
612f106906
commit
ca8f3337c4
@ -0,0 +1,47 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
||||||
|
use Doctrine\DBAL\Schema\Schema; |
||||||
|
|
||||||
|
class Version20230321154019 extends AbstractMigrationChamilo |
||||||
|
{ |
||||||
|
public function getDescription(): string |
||||||
|
{ |
||||||
|
return 'Create table track_e_attempt_qualify'; |
||||||
|
} |
||||||
|
|
||||||
|
public function up(Schema $schema): void |
||||||
|
{ |
||||||
|
if (!$schema->hasTable('track_e_attempt_qualify')) { |
||||||
|
$this->addSql( |
||||||
|
"CREATE TABLE track_e_attempt_qualify ( |
||||||
|
id INT AUTO_INCREMENT NOT NULL, |
||||||
|
exe_id INT NOT NULL, |
||||||
|
question_id INT NOT NULL, |
||||||
|
marks INT NOT NULL, |
||||||
|
insert_date DATETIME NOT NULL COMMENT '(DC2Type:datetime)', |
||||||
|
author INT NOT NULL, |
||||||
|
teacher_comment LONGTEXT NOT NULL, |
||||||
|
session_id INT NOT NULL, |
||||||
|
answer LONGTEXT DEFAULT NULL, |
||||||
|
INDEX exe_id (exe_id), INDEX question_id (question_id), |
||||||
|
INDEX session_id (session_id), |
||||||
|
PRIMARY KEY(id) |
||||||
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" |
||||||
|
); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public function down(Schema $schema): void |
||||||
|
{ |
||||||
|
if ($schema->hasTable('track_e_attempt_qualify')) { |
||||||
|
$this->addSql('DROP TABLE track_e_attempt_qualify;'); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\TrackEAttemptQualify; |
||||||
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
||||||
|
use Doctrine\DBAL\Schema\Schema; |
||||||
|
|
||||||
|
class Version20230321164019 extends AbstractMigrationChamilo |
||||||
|
{ |
||||||
|
public function getDescription(): string |
||||||
|
{ |
||||||
|
return 'Migrate track_e_attempt_recording'; |
||||||
|
} |
||||||
|
|
||||||
|
public function up(Schema $schema): void |
||||||
|
{ |
||||||
|
$container = $this->getContainer(); |
||||||
|
$doctrine = $container->get('doctrine'); |
||||||
|
$em = $doctrine->getManager(); |
||||||
|
|
||||||
|
$sql = 'SELECT * FROM track_e_attempt_recording'; |
||||||
|
$connection = $this->getEntityManager()->getConnection(); |
||||||
|
$result = $connection->executeQuery($sql); |
||||||
|
$items = $result->fetchAllAssociative(); |
||||||
|
|
||||||
|
foreach ($items as $item) { |
||||||
|
$trackQualify = new TrackEAttemptQualify(); |
||||||
|
$trackQualify |
||||||
|
->setExeId($item['exe_id']) |
||||||
|
->setQuestionId($item['question_id']) |
||||||
|
->setAnswer($item['answer']) |
||||||
|
->setMarks((int) $item['marks']) |
||||||
|
->setAuthor($item['author']) |
||||||
|
->setTeacherComment($item['teacher_comment']) |
||||||
|
->setSessionId($item['session_id']) |
||||||
|
; |
||||||
|
$em->persist($trackQualify); |
||||||
|
$em->flush(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public function down(Schema $schema): void |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
||||||
|
use Doctrine\DBAL\Schema\Schema; |
||||||
|
|
||||||
|
class Version20230321165019 extends AbstractMigrationChamilo |
||||||
|
{ |
||||||
|
public function getDescription(): string |
||||||
|
{ |
||||||
|
return 'Delete track_e_attempt_recording'; |
||||||
|
} |
||||||
|
|
||||||
|
public function up(Schema $schema): void |
||||||
|
{ |
||||||
|
if ($schema->hasTable('track_e_attempt_recording')) { |
||||||
|
$schema->dropTable('track_e_attempt_recording'); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public function down(Schema $schema): void |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue