File size: 757 Bytes
d2897cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

declare(strict_types=1);

namespace Mautic\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;

final class Version20230311195347 extends AbstractMauticMigration
{
    public const BATCH_SIZE = 1000;

    public function up(Schema $schema): void
    {
        $tableName  = MAUTIC_TABLE_PREFIX.'integration_entity';
        $columnName = 'integration';
        $value      = 'Pipedrive';

        $connection = $this->connection;
        $rowCount   = self::BATCH_SIZE;

        while ($rowCount) {
            $sql      = "DELETE FROM $tableName WHERE $columnName = :value LIMIT ".self::BATCH_SIZE;
            $rowCount = $connection->executeStatement($sql, ['value' => $value]);
        }
    }
}