Skip to content

Conversation

@dereuromark
Copy link
Member

Summary

  • Add --fake flag to seeds run command to mark seeds as executed without running them
  • Add --seed option to seeds reset command for selective seed reset

New features

Fake seeding:

# Mark a seed as executed without running it
bin/cake seeds run Users --fake

# Useful when you've manually populated data or want to skip certain seeds

Selective reset:

# Reset only specific seeds
bin/cake seeds reset --seed Users
bin/cake seeds reset --seed Users,Posts

# Still supports resetting all seeds (existing behavior)
bin/cake seeds reset

Both features mirror similar functionality available in migrations.

@dereuromark dereuromark force-pushed the seed-fake-and-selective-reset branch from 0a5febc to b9227fd Compare January 3, 2026 15:42
- Add --fake flag to mark seeds as executed without running them
- Add --seed option to seeds reset for selective seed reset
- Both features mirror similar functionality in migrations
@dereuromark dereuromark force-pushed the seed-fake-and-selective-reset branch from b9227fd to 910dc1d Compare January 9, 2026 06:00
@dereuromark dereuromark requested a review from markstory January 11, 2026 02:36
Comment on lines 574 to 577
if (!$seed->isIdempotent()) {
$executedTime = date('Y-m-d H:i:s');
$adapter->seedExecuted($seed, $executedTime);
}
Copy link
Member

Choose a reason for hiding this comment

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

Won't this leave idempotent seeds as not faked?

Copy link
Member Author

@dereuromark dereuromark Jan 11, 2026

Choose a reason for hiding this comment

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

This could indeed be a bit confusing:

  1. User runs seeds --fake expecting all seeds to be marked as executed
  2. Idempotent seeds appear to be "faked" (output says so) but nothing is actually recorded
  3. Next time they run seeds, the idempotent ones will run again (which might be fine for idempotent seeds, but the messaging is misleading)

The question is: what should the behavior be?

Option A: Keep current behavior but improve messaging - show "skipped (idempotent - not tracked)" instead of "faked" for idempotent seeds

Option B: Skip idempotent seeds entirely when using --fake (with appropriate messaging)

I would say A.

Idempotent seeds are not tracked, so faking them doesn't make sense.
Instead of showing misleading "faking"/"faked" messages, now shows
"skipped (idempotent)" to clarify what's happening.
@dereuromark
Copy link
Member Author

Adjusted as per review.

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.

4 participants