File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
lib/internal/Magento/Framework/Setup
Test/Unit/Declaration/Schema Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,10 @@ public function getDestructiveOperations()
132132 private function startSetupForAllConnections ()
133133 {
134134 foreach ($ this ->sharding ->getResources () as $ resource ) {
135- $ this ->resourceConnection ->getConnection ($ resource )
136- -> startSetup ();
137- $ this -> resourceConnection -> getConnection ( $ resource )
138- ->query ('SET UNIQUE_CHECKS=0 ' );
135+ $ connection = $ this ->resourceConnection ->getConnection ($ resource );
136+
137+ $ connection -> startSetup ();
138+ $ connection ->query ('SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 ' );
139139 }
140140 }
141141
@@ -148,8 +148,10 @@ private function startSetupForAllConnections()
148148 private function endSetupForAllConnections ()
149149 {
150150 foreach ($ this ->sharding ->getResources () as $ resource ) {
151- $ this ->resourceConnection ->getConnection ($ resource )
152- ->endSetup ();
151+ $ connection = $ this ->resourceConnection ->getConnection ($ resource );
152+
153+ $ connection ->query ('SET UNIQUE_CHECKS=IF(@OLD_UNIQUE_CHECKS=0, 0, 1) ' );
154+ $ connection ->endSetup ();
153155 }
154156 }
155157
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ public function testExecute()
160160 $ connectionMock = $ this ->getMockBuilder (Mysql::class)
161161 ->disableOriginalConstructor ()
162162 ->getMock ();
163- $ this ->resourceConnectionMock ->expects (self ::exactly (3 ))
163+ $ this ->resourceConnectionMock ->expects (self ::exactly (2 ))
164164 ->method ('getConnection ' )
165165 ->with ('default ' )
166166 ->willReturn ($ connectionMock );
You can’t perform that action at this time.
0 commit comments