Skip to content

Conversation

@dereuromark
Copy link
Member

Seeds cleanup

Modernized the migrations seed command to use a cleaner argument-based syntax instead of options, added safety confirmations, and improved the overall user experience.

Key Improvements

  1. Simpler Syntax
  • Old: migrations seed --seed Users --seed Posts
  • New: migrations seed Users,Posts
  1. Safety First

When running all seeds without arguments, users now see:

  • List of seeds that will execute
  • Warning that seeds don't track execution state
  • Confirmation prompt (default: 'n' to prevent accidents)
  1. Automation Support
  • Use -q (quiet mode) to skip confirmation
  • Changed dry-run short option from -x to -d (more intuitive)
  1. Cleaner Display
  • Better help documentation with practical examples

@dereuromark dereuromark requested a review from markstory November 1, 2025 14:20
Comment on lines +196 to +200
$continue = $io->askChoice('Do you want to continue?', ['y', 'n'], 'n');
if ($continue !== 'y') {
$io->warning('Seed operation aborted.');

return self::CODE_SUCCESS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could always ask for confirmation. If users don't want to deal with a confirmation prompt they can use the -q parameter or specify which seeds are to be run.

Copy link
Member Author

@dereuromark dereuromark Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats already how its done above with

if ($io->level() > ConsoleIo::QUIET) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting that we don't have a confirm to go with the comment about having --all and no implicit run all. I get why you don't want to do that though.

Comment on lines +161 to +167
try {
$availableSeeds = $manager->getSeeds();
} catch (Exception $e) {
$io->error('Failed to load seeds: ' . $e->getMessage());

return static::CODE_ERROR;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that defaulting to running all seeds is a risky default, that should be an error instead. If there is a need for a 'run all' mode we could add a --all option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats why there is now a list of what seeds run and the confirmation before doing. The Extra option is not needed this way. You cannot a accidently do it anymore.

@dereuromark dereuromark requested a review from markstory November 2, 2025 03:57
@markstory markstory merged commit 106ff79 into 5.x Nov 2, 2025
13 checks passed
@markstory markstory deleted the 5.x-seeds branch November 2, 2025 19:07
@dereuromark dereuromark mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants