diff --git a/Console/Command/RestoreUseDefaultValueCommand.php b/Console/Command/RestoreUseDefaultValueCommand.php index 286750b..b537ba6 100755 --- a/Console/Command/RestoreUseDefaultValueCommand.php +++ b/Console/Command/RestoreUseDefaultValueCommand.php @@ -107,22 +107,18 @@ public function execute(InputInterface $input, OutputInterface $output) $counts[$row['attribute_id']]++; } } + } - $nullValues = $db->fetchOne( - 'SELECT COUNT(*) FROM ' . $fullTableName - . ' WHERE store_id = ? AND value IS NULL', - [$row['store_id']] - ); + $nullValues = $db->fetchOne( + 'SELECT COUNT(*) FROM ' . $fullTableName . ' WHERE store_id != 0 AND value IS NULL' + ); - if (!$isDryRun && $nullValues > 0) { - $output->writeln("Deleting " . $nullValues . " NULL value(s) from " . $fullTableName); - // Remove all non-global null values - $db->query( - 'DELETE FROM ' . $fullTableName - . ' WHERE store_id = ? AND value IS NULL', - [$row['store_id']] - ); - } + if (!$isDryRun && $nullValues > 0) { + $output->writeln("Deleting " . $nullValues . " NULL value(s) from " . $fullTableName); + // Remove all non-global null values + $db->query( + 'DELETE FROM ' . $fullTableName . ' WHERE store_id != 0 AND value IS NULL' + ); } if (count($counts)) {