Migration1675082889DropUnusedTables example

try {
            $this->connection->executeStatement('CREATE TABLE IF NOT EXISTS `message_queue_stats` (id BINARY(16) NOT NULL, PRIMARY KEY(id))');
            $this->connection->executeStatement('CREATE TABLE IF NOT EXISTS `mail_template_sales_channel` (id BINARY(16) NOT NULL, PRIMARY KEY(id))');
            $this->connection->executeStatement('CREATE TABLE IF NOT EXISTS `sales_channel_rule` (id BINARY(16) NOT NULL, PRIMARY KEY(id))');
        } catch (\Throwable $e) {
        }
    }

    public function testRunMultipleTimes(): void
    {
        $m = new Migration1675082889DropUnusedTables();

        $m->update($this->connection);
        $m->update($this->connection);

        $triggers = array_flip(array_column($this->connection->fetchAllAssociative('SHOW TRIGGERS'), 'Trigger'));
        static::assertArrayNotHasKey('customer_address_vat_id_insert', $triggers);
        static::assertArrayNotHasKey('customer_address_vat_id_update', $triggers);
        static::assertArrayNotHasKey('order_cash_rounding_insert', $triggers);

        static::assertFalse(EntityDefinitionQueryHelper::tableExists($this->connection, 'message_queue_stats'));
        static::assertFalse(EntityDefinitionQueryHelper::tableExists($this->connection, 'mail_template_sales_channel'));
        
Home | Imprint | This part of the site doesn't use cookies.