Skip to content

Commit 710649f

Browse files
committed
fix: remove -g option in migrate:rollback
Rollback specifies a batch number and returns the database to that state. It is not possible to specify a specific group to return to a state.
1 parent 6cc94db commit 710649f

3 files changed

Lines changed: 4 additions & 15 deletions

File tree

system/Commands/Database/MigrateRollback.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class MigrateRollback extends BaseCommand
5858
*/
5959
protected $options = [
6060
'-b' => 'Specify a batch to roll back to; e.g. "3" to return to batch #3',
61-
'-g' => 'Set database group',
6261
'-f' => 'Force command - this option allows you to bypass the confirmation question when running this command in a production environment',
6362
];
6463

@@ -79,11 +78,6 @@ public function run(array $params)
7978
}
8079

8180
$runner = Services::migrations();
82-
$group = $params['g'] ?? CLI::getOption('g');
83-
84-
if (is_string($group)) {
85-
$runner->setGroup($group);
86-
}
8781

8882
try {
8983
$batch = $params['b'] ?? CLI::getOption('b') ?? $runner->getLastBatch() - 1;

system/Database/MigrationRunner.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,10 @@ public function latest(?string $group = null)
220220
*
221221
* Calls each migration step required to get to the provided batch
222222
*
223-
* @param int $targetBatch Target batch number, or negative for a relative batch, 0 for all
223+
* @param int $targetBatch Target batch number, or negative for a relative batch, 0 for all
224+
* @param string|null $group Deprecated. The designation has no effect.
224225
*
225-
* @return mixed Current batch number on success, FALSE on failure or no migrations are found
226+
* @return bool True on success, FALSE on failure or no migrations are found
226227
*
227228
* @throws ConfigException
228229
* @throws RuntimeException
@@ -233,11 +234,6 @@ public function regress(int $targetBatch = 0, ?string $group = null)
233234
throw ConfigException::forDisabledMigrations();
234235
}
235236

236-
// Set database group if not null
237-
if ($group !== null) {
238-
$this->setGroup($group);
239-
}
240-
241237
$this->ensureTable();
242238

243239
$batches = $this->getBatches();

user_guide_src/source/dbmgmt/migration.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,14 @@ to minimize any potential conflicts between the main application and any modules
144144
rollback
145145
========
146146

147-
Rolls back all migrations, taking the database group to a blank slate, effectively migration 0:
147+
Rolls back all migrations to a blank slate, effectively migration 0:
148148

149149
.. code-block:: console
150150
151151
php spark migrate:rollback
152152
153153
You can use (rollback) with the following options:
154154

155-
- ``-g`` - to choose database group, otherwise default database group will be used.
156155
- ``-b`` - to choose a batch: natural numbers specify the batch.
157156
- ``-f`` - to force a bypass confirmation question, it is only asked in a production environment.
158157

0 commit comments

Comments
 (0)