You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/src/Command/DatabaseCreate.php
+25-18Lines changed: 25 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,8 @@ protected function configure()
15
15
$this
16
16
->setDescription('Creates a database & associated user in parallel on all configured database instances')
17
17
->addOption('database', null, InputOption::VALUE_REQUIRED, 'The name of the database to create')
18
-
->addOption('user', null, InputOption::VALUE_REQUIRED, 'The name of the user to create. If omitted, the database name will be used as user name')
19
-
->addOption('password', null, InputOption::VALUE_REQUIRED, 'The password. If omitted, a random one will be generated and echoed to stderr')
18
+
->addOption('user', null, InputOption::VALUE_REQUIRED, 'The name of a user to create with r/w access to the new database. If omitted, no user will be created')
19
+
->addOption('password', null, InputOption::VALUE_REQUIRED, 'The password. If omitted, a random one will be generated and echoed as part of results')
20
20
->addOption('charset', null, InputOption::VALUE_REQUIRED, 'The collation/character-set to use for the database. If omitted, the default collation for the instance will be used')
21
21
->addCommonOptions()
22
22
;
@@ -41,24 +41,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
Copy file name to clipboardExpand all lines: app/src/Command/DatabaseManagingCommand.php
+20-13Lines changed: 20 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ abstract class DatabaseManagingCommand extends SQLExecutingCommand
10
10
* @param string[][] $instanceList
11
11
* @param array[] $dbSpecList key: db name (as used to identify configured databases), value: array('user': mandatory, 'dbname': mandatory, 'password': mandatory)
12
12
* @return array 'succeeded': int, 'failed': int, 'results': same format as dbConfigurationManager::getInstanceConfiguration
@@ -51,19 +55,22 @@ function ($schemaManager, $instanceName) use ($dbSpecList) {
51
55
/**
52
56
* @param string[][] $instanceList
53
57
* @param array[] $dbSpecList key: db name (as used to identify configured databases), value: array('user': mandatory, 'dbname': mandatory, if unspecified assumed same as user)
Copy file name to clipboardExpand all lines: app/src/Command/SQLExecutingCommand.php
+27-19Lines changed: 27 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -45,12 +45,12 @@ public function __construct(
45
45
protectedfunctionaddCommonOptions()
46
46
{
47
47
$this
48
-
->addOption('output-type', null, InputOption::VALUE_REQUIRED, 'The format for the output: json, php, text or yml', self::DEFAULT_OUTPUT_FORMAT)
49
-
->addOption('timeout', null, InputOption::VALUE_REQUIRED, 'The maximum time to wait for execution (secs)', self::DEFAULT_PROCESS_TIMEOUT)
50
-
->addOption('max-parallel', null, InputOption::VALUE_REQUIRED, 'The maximum number of processes to run in parallel', self::DEFAULT_PARALLEL_PROCESSES)
51
-
->addOption('dont-force-enabled-sigchild', null, InputOption::VALUE_NONE, "When using a separate php process to run each sql command, do not force Symfony to believe that php was compiled with --enable-sigchild option")
52
48
->addOption('only-instances', null, InputOption::VALUE_REQUIRED, 'Filter the database servers to run this command against. Usage of * and ? wildcards is allowed. To see all instances available, use `instance:list`', null)
53
-
->addOption('except-instances', null, InputOption::VALUE_REQUIRED, 'Filter the database servers to run this command against.', null)
49
+
->addOption('except-instances', null, InputOption::VALUE_REQUIRED, 'Filter the database servers to run this command against', null)
50
+
->addOption('output-type', null, InputOption::VALUE_REQUIRED, 'The format for the output: json, php, text or yml', self::DEFAULT_OUTPUT_FORMAT)
51
+
->addOption('timeout', null, InputOption::VALUE_REQUIRED, 'The maximum time to wait for subprocess execution (secs)', self::DEFAULT_PROCESS_TIMEOUT)
52
+
->addOption('max-parallel', null, InputOption::VALUE_REQUIRED, 'The maximum number of subprocesses to run in parallel', self::DEFAULT_PARALLEL_PROCESSES)
53
+
->addOption('dont-force-enabled-sigchild', null, InputOption::VALUE_NONE, "When using a separate process to run each sql command, do not force Symfony to believe that php was compiled with --enable-sigchild option")
54
54
;
55
55
}
56
56
@@ -214,35 +214,43 @@ protected function executeSqlAction($instanceList, $actionName, $getSqlActionCal
214
214
}
215
215
216
216
/**
217
-
* @param array $results should contain elements: succeeded(int) failed(int), data(mixed)
218
-
* @param float $time execution time in seconds
219
-
* @throws \Exception for unsupported formats
217
+
* @param array $results
218
+
* @return string
219
+
* @throws \OutOfBoundsException for unsupported output formats
Copy file name to clipboardExpand all lines: app/src/Command/SqlExecute.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ protected function configure()
22
22
->addOption('sql', null, InputOption::VALUE_REQUIRED, 'The sql command(s) string to execute')
23
23
->addOption('file', null, InputOption::VALUE_REQUIRED, "A file with sql commands to execute. The tokens '{dbtype}' and '{instancename}' will be replaced with actual values")
24
24
25
-
->addOption('database', null, InputOption::VALUE_REQUIRED, 'The name of an existing the database to use. If omitted a dedicated temporary database will be created on the fly and disposed after use')
25
+
->addOption('database', null, InputOption::VALUE_REQUIRED, 'The name of an existing database to use. If omitted, a dedicated temporary database will be created on the fly and disposed after use')
26
26
->addOption('user', null, InputOption::VALUE_REQUIRED, 'The name of the user to use for connecting to the existing database. Temporary databases get created with a temp user and random password')
27
27
->addOption('password', null, InputOption::VALUE_REQUIRED, 'The user password')
28
28
->addOption('charset', null, InputOption::VALUE_REQUIRED, 'The collation/character-set to use, _only_ for the dedicated temporary database. If omitted, the default collation for the instance will be used')
@@ -65,6 +65,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
65
65
66
66
if (($dbName == null) xor ($userName == null)) {
67
67
68
+
/// @todo is it possible to let the user log in to the 'root' db, regardless of db type ?
69
+
68
70
thrownew \Exception("Please provide both a custom database name and associated user account");
69
71
}
70
72
@@ -136,7 +138,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
0 commit comments