File tree Expand file tree Collapse file tree 9 files changed +81
-9
lines changed Expand file tree Collapse file tree 9 files changed +81
-9
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,16 @@ protected function configure(): void
226
226
null ,
227
227
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY ,
228
228
'Environment variable for elasticsearch service '
229
+ )->addOption (
230
+ Source \CliSource::OPTION_DB_INCREMENT_INCREMENT ,
231
+ null ,
232
+ InputOption::VALUE_REQUIRED ,
233
+ '"auto_increment_increment" database variable '
234
+ )->addOption (
235
+ Source \CliSource::OPTION_DB_INCREMENT_OFFSET ,
236
+ null ,
237
+ InputOption::VALUE_REQUIRED ,
238
+ '"auto_increment_offset" database variable '
229
239
);
230
240
231
241
parent ::configure ();
Original file line number Diff line number Diff line change @@ -464,6 +464,7 @@ private function addDbService(
464
464
): void {
465
465
$ volumePrefix = $ config ->getNameWithPrefix ();
466
466
$ mounts [] = $ volumePrefix . self ::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d ' ;
467
+ $ commands = [];
467
468
468
469
switch ($ service ) {
469
470
case self ::SERVICE_DB :
@@ -478,6 +479,15 @@ private function addDbService(
478
479
$ mounts [] = $ volumePrefix . self ::VOLUME_MAGENTO_DB . ':/var/lib/mysql ' ;
479
480
$ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d ' ;
480
481
$ serviceType = ServiceInterface::SERVICE_DB ;
482
+
483
+ if ($ config ->getDbIncrementIncrement () > 1 ) {
484
+ $ commands [] = '--auto_increment_increment= ' . $ config ->getDbIncrementIncrement ();
485
+ }
486
+
487
+ if ($ config ->getDbIncrementOffset () > 1 ) {
488
+ $ commands [] = '--auto_increment_offset= ' . $ config ->getDbIncrementOffset ();
489
+ }
490
+
481
491
break ;
482
492
case self ::SERVICE_DB_QUOTE :
483
493
$ port = $ config ->getDbQuotePortsExpose ();
@@ -511,15 +521,21 @@ private function addDbService(
511
521
throw new GenericException (sprintf ('Configuration for %s service not exist ' , $ service ));
512
522
}
513
523
524
+ $ dbConfig = [
525
+ 'ports ' => [$ port ? "$ port:3306 " : '3306 ' ],
526
+ 'volumes ' => $ mounts ,
527
+ ];
528
+
529
+ if ($ commands ) {
530
+ $ dbConfig ['command ' ] = implode (' ' , $ commands );
531
+ }
532
+
514
533
$ manager ->addService (
515
534
$ service ,
516
535
$ this ->serviceFactory ->create (
517
536
$ serviceType ,
518
537
$ version ,
519
- [
520
- 'ports ' => [$ port ? "$ port:3306 " : '3306 ' ],
521
- 'volumes ' => $ mounts ,
522
- ]
538
+ $ dbConfig
523
539
),
524
540
[self ::NETWORK_MAGENTO ],
525
541
[]
Original file line number Diff line number Diff line change @@ -388,4 +388,28 @@ public function getMagentoVersion(): ?string
388
388
{
389
389
return $ this ->all ()->get (SourceInterface::MAGENTO_VERSION );
390
390
}
391
+
392
+ /**
393
+ * @return int
394
+ * @throws ConfigurationMismatchException
395
+ */
396
+ public function getDbIncrementIncrement (): int
397
+ {
398
+ return max (
399
+ (int )$ this ->all ()->get (SourceInterface::SYSTEM_DB_INCREMENT_INCREMENT , 1 ),
400
+ 1
401
+ );
402
+ }
403
+
404
+ /**
405
+ * @return int
406
+ * @throws ConfigurationMismatchException
407
+ */
408
+ public function getDbIncrementOffset (): int
409
+ {
410
+ return max (
411
+ (int )$ this ->all ()->get (SourceInterface::SYSTEM_DB_INCREMENT_OFFSET , 1 ),
412
+ 1
413
+ );
414
+ }
391
415
}
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ class CliSource implements SourceInterface
55
55
public const OPTION_HOST = 'host ' ;
56
56
public const OPTION_PORT = 'port ' ;
57
57
58
+ public const OPTION_DB_INCREMENT_INCREMENT = 'db-increment-increment ' ;
59
+ public const OPTION_DB_INCREMENT_OFFSET = 'db-increment-offset ' ;
60
+
58
61
/**
59
62
* Environment variable for elasticsearch service.
60
63
*/
@@ -213,6 +216,14 @@ public function read(): Repository
213
216
$ repository ->set (self ::SERVICES_ES_VARS , $ esEnvVars );
214
217
}
215
218
219
+ if ($ incrementIncrement = $ this ->input ->getOption (self ::OPTION_DB_INCREMENT_INCREMENT )) {
220
+ $ repository ->set (SourceInterface::SYSTEM_DB_INCREMENT_INCREMENT , $ incrementIncrement );
221
+ }
222
+
223
+ if ($ incrementOffset = $ this ->input ->getOption (self ::OPTION_DB_INCREMENT_OFFSET )) {
224
+ $ repository ->set (SourceInterface::SYSTEM_DB_INCREMENT_OFFSET , $ incrementOffset );
225
+ }
226
+
216
227
return $ repository ;
217
228
}
218
229
}
Original file line number Diff line number Diff line change @@ -120,6 +120,9 @@ interface SourceInterface
120
120
public const SYSTEM_EXPOSE_DB_QUOTE_PORTS = 'system.expose_db_quote_ports ' ;
121
121
public const SYSTEM_EXPOSE_DB_SALES_PORTS = 'system.expose_db_sales_ports ' ;
122
122
123
+ public const SYSTEM_DB_INCREMENT_INCREMENT = 'system.db.increment_increment ' ;
124
+ public const SYSTEM_DB_INCREMENT_OFFSET = 'system.db.increment_offset ' ;
125
+
123
126
public const VARIABLES = 'variables ' ;
124
127
125
128
public const HOOKS = 'hooks ' ;
Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ public function buildDataProvider(): array
85
85
[CliSource::OPTION_WITH_CRON , true ],
86
86
[CliSource::OPTION_WITH_XDEBUG , true ],
87
87
[CliSource::OPTION_ES , '5.2 ' ],
88
- [CliSource::OPTION_NO_ES , true ]
88
+ [CliSource::OPTION_NO_ES , true ],
89
+ [CliSource::OPTION_DB_INCREMENT_INCREMENT , 3 ],
90
+ [CliSource::OPTION_DB_INCREMENT_OFFSET , 2 ],
89
91
]
90
92
]
91
93
];
Original file line number Diff line number Diff line change @@ -81,7 +81,11 @@ public function buildDataProvider(): array
81
81
'system ' => [
82
82
'mode ' => 'production ' ,
83
83
'host ' => 'magento2.test ' ,
84
- 'port ' => '8080 '
84
+ 'port ' => '8080 ' ,
85
+ 'db ' => [
86
+ 'increment_increment ' => 3 ,
87
+ 'increment_offset ' => 2
88
+ ]
85
89
],
86
90
'services ' => [
87
91
'php ' => [
@@ -97,9 +101,9 @@ public function buildDataProvider(): array
97
101
],
98
102
],
99
103
'hooks ' => [
100
- 'build ' => 'set -e
101
- php ./vendor/bin/ece-tools run scenario/build/generate.xml
102
- php ./vendor/bin/ece-tools run scenario/build/transfer.xml ' ,
104
+ 'build ' => 'set -e ' . PHP_EOL
105
+ . ' php ./vendor/bin/ece-tools run scenario/build/generate.xml ' . PHP_EOL
106
+ . ' php ./vendor/bin/ece-tools run scenario/build/transfer.xml ' ,
103
107
'deploy ' => 'php ./vendor/bin/ece-tools run scenario/deploy.xml ' ,
104
108
'post_deploy ' => 'php ./vendor/bin/ece-tools run scenario/post-deploy.xml '
105
109
],
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ services:
15
15
- ' mymagento-mariadb-conf:/etc/mysql/mariadb.conf.d'
16
16
- ' mymagento-magento-db:/var/lib/mysql'
17
17
- ' docker-entrypoint:/docker-entrypoint-initdb.d'
18
+ command : ' --auto_increment_increment=3 --auto_increment_offset=2'
18
19
networks :
19
20
magento :
20
21
aliases :
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ services:
15
15
- ' magento-mariadb-conf:/etc/mysql/mariadb.conf.d'
16
16
- ' magento-magento-db:/var/lib/mysql'
17
17
- ' docker-entrypoint:/docker-entrypoint-initdb.d'
18
+ command : ' --auto_increment_increment=3 --auto_increment_offset=2'
18
19
networks :
19
20
magento :
20
21
aliases :
You can’t perform that action at this time.
0 commit comments