Skip to content

Add --yes to skip seed and reset confirmations - #1128

Open
dereuromark wants to merge 2 commits into
5.xfrom
non-interactive-confirm
Open

dereuromark wants to merge 2 commits into
5.xfrom
non-interactive-confirm

Conversation

@dereuromark

Copy link
Copy Markdown
Member

Automated deploys had no clean way past the seed and reset confirmations. --force on seeds run does not skip the prompt; it re-runs seeds that already ran. The only working option was -q, which also hides the output, and it only works for seeds run.

This adds --yes (-y) to seeds run, seeds reset and migrations reset. It skips the prompt and keeps normal output.

seeds reset -q and migrations reset -q used to answer the prompt with its default "n", print "Reset operation aborted." and exit 0, so a CI job passed without resetting anything. Without --yes they now fail with a non-zero exit code and tell you to pass --yes. --dry-run still needs no confirmation, and seeds run -q still skips its prompt as before.

Command Before After
seeds run --yes unknown option runs all seeds, shows the list, no prompt
seeds run -q runs all seeds unchanged
seeds reset -q aborts, exit 0 error "Pass --yes to continue", exit 1
seeds reset -q --yes unknown option resets, exit 0
migrations reset -q aborts, nothing dropped, exit 0 error, nothing dropped, exit 1
migrations reset --yes unknown option drops tables and re-runs migrations

Docs: seeding guide and a new "Non-interactive Commands" section under Deployment.

Follow-up on the core side: cakephp/cakephp draft PR adding ConsoleIo::isInteractive() and a --no-interaction option, so commands can check interactivity directly instead of reading --quiet.

seeds run, seeds reset and migrations reset now accept --yes (-y) to
skip the confirmation prompt while keeping normal output.

In non-interactive mode (-q) without --yes, seeds reset and migrations
reset now exit with an error instead of answering the prompt with its
default "n" and exiting 0 without doing anything. seeds run -q keeps
skipping its prompt.
nook24 added a commit to openITCOCKPIT/openITCOCKPIT that referenced this pull request Nov 20, 2026
For now, we use 'yes | oitc seeds run' to execute our seeds. This will ensure
that we still get back an output in case something goes wrong.

As soon as cakephp/migrations#1128 gets merged,
we can remove the 'yes |' workaround and use --yes instead.

--force was a dirty hack to make sure that all seeds gets executed
on every run (like the old migrations plugin did) We still need this behavior
but the clean way is to mark the seed to be Idempotent
https://book.cakephp.org/migrations/5/guides/seeding.html#idempotent-seeds
@nook24

nook24 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Much appreciated. Currently I have to use a workaround like yes | bin/cake seeds run which leads to confusion output on the terminal:

Importing default records for PrometheusModule into database

The following seeds will be executed:
  - Install (idempotent)


Do you want to continue? (y/n)
[n] >
 == Install seed: seeding
 == Install seed: seeded 0.0369s
All Done. Took 0.0704s

So a --yes option would be nice to have :) Thanks!

@dereuromark dereuromark mentioned this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants