Skip to content

Commit 63d10c9

Browse files
Only add problemtexts to new table if they are not null.
1 parent 541fe1d commit 63d10c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

webapp/migrations/Version20231124133426.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function up(Schema $schema): void
2121
{
2222
// this up() migration is auto-generated, please modify it to your needs
2323
$this->addSql('CREATE TABLE problem_text_content (probid INT UNSIGNED NOT NULL COMMENT \'Problem ID\', content LONGBLOB NOT NULL COMMENT \'Text content(DC2Type:blobtext)\', PRIMARY KEY(probid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'Stores contents of problem texts\' ');
24-
$this->addSql('INSERT INTO problem_text_content (probid, content) SELECT probid, problemtext FROM problem');
24+
$this->addSql('INSERT INTO problem_text_content (probid, content) SELECT probid, problemtext FROM problem WHERE problemtext IS NOT NULL');
2525
$this->addSql('ALTER TABLE problem_text_content ADD CONSTRAINT FK_21B6AD6BEF049279 FOREIGN KEY (probid) REFERENCES problem (probid) ON DELETE CASCADE');
2626
$this->addSql('ALTER TABLE problem DROP problemtext');
2727
}

0 commit comments

Comments
 (0)