Symfony – migration update set to null if empty

I want to update every field in a specific table when running a migration that if it is '' to be updated with NULL.

I have set one of the fields in db to '' so I can test it.

I am getting an error when running that specific migration:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘DoctrineMigrationsVersion20211129141541’ for key ‘PRIMARY’

And my migration file:

    final class Version20211129141541 extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('UPDATE post SET context=NULL WHERE context=""');
        $this->addSql('UPDATE post SET info=NULL WHERE info=""');
    }

    public function down(Schema $schema): void
    {

    }
}

Is this anyway the right approach?