@@ -160,15 +160,15 @@ public function dumpData($table, Table $tableConfig, Connection $db, bool $noPro
160
160
$ s .= $ tableConfig ->getCondition ();
161
161
162
162
$ this ->output ->writeln ("-- BEGIN DATA $ table " , OutputInterface::OUTPUT_RAW );
163
- $ this ->output -> writeln ( " LOCK TABLES ` $ table` WRITE; " , OutputInterface:: OUTPUT_RAW );
163
+ $ this ->writeDataDumpBegin ( $ table );
164
164
165
165
$ bufferSize = 0 ;
166
166
$ max = $ this ->bufferSize ;
167
167
$ numRows = (int )$ db ->fetchColumn ("SELECT COUNT(*) FROM ` $ table` " .$ tableConfig ->getCondition ());
168
168
169
169
if (0 === $ numRows ) {
170
170
// Fail fast: No data to dump.
171
- $ this ->writeDataDumpEnd ();
171
+ $ this ->writeDataDumpEnd ($ table );
172
172
return ;
173
173
}
174
174
@@ -240,7 +240,7 @@ public function dumpData($table, Table $tableConfig, Connection $db, bool $noPro
240
240
$ this ->output ->writeln ('; ' , OutputInterface::OUTPUT_RAW );
241
241
}
242
242
243
- $ this ->writeDataDumpEnd ();
243
+ $ this ->writeDataDumpEnd ($ table );
244
244
}
245
245
246
246
/**
@@ -304,8 +304,15 @@ private function keepalive(Connection $db)
304
304
}
305
305
}
306
306
307
- protected function writeDataDumpEnd (): void
307
+ protected function writeDataDumpBegin ($ table ): void
308
+ {
309
+ $ this ->output ->writeln ("LOCK TABLES ` $ table` WRITE; " , OutputInterface::OUTPUT_RAW );
310
+ $ this ->output ->writeln ("ALTER TABLE ` $ table` DISABLE KEYS; " , OutputInterface::OUTPUT_RAW );
311
+ }
312
+
313
+ protected function writeDataDumpEnd ($ table ): void
308
314
{
315
+ $ this ->output ->writeln ("ALTER TABLE ` $ table` ENABLE KEYS; " , OutputInterface::OUTPUT_RAW );
309
316
$ this ->output ->writeln ("UNLOCK TABLES; " , OutputInterface::OUTPUT_RAW );
310
317
$ this ->output ->writeln ('' , OutputInterface::OUTPUT_RAW );
311
318
}
0 commit comments