Skip to content

Conversation

@FranjoMindek
Copy link
Contributor

@FranjoMindek FranjoMindek commented Dec 7, 2025

Description

Adds the --force flag option to wasp db reset command, which just relays the --force flag to the prisma CLI. This makes it reset the database without any interaction (no y/n needed).

I picked the option which stays in line with the prisma workflow the most.

Possible variations:

  1. Pick a different flag name than prisma (not --force)
  2. Making it non-interactive by default (would not go this route, breaking change also)

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

"start" : optionalStartArgs -> runCommand $ Command.Start.Db.start optionalStartArgs
-- These commands require an existing and running database.
["reset"] -> runCommandThatRequiresDbRunning Command.Db.Reset.reset
"reset" : optionalResetArgs -> runCommandThatRequiresDbRunning $ Command.Db.Reset.reset optionalResetArgs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the pattern that migrate-dev command used.

@FranjoMindek FranjoMindek marked this pull request as ready for review December 7, 2025 20:58
@infomiho infomiho self-requested a review December 8, 2025 08:27
Comment on lines 40 to 47
parseResetArgs :: [String] -> Either String ResetArgs
parseResetArgs resetArgs = do
go resetArgs defaultResetArgs
where
go :: [String] -> ResetArgs -> Either String ResetArgs
go [] currentResetArgs = Right currentResetArgs
go ("--force" : rest) currentResetArgs = go rest $ currentResetArgs {_force = True}
go unknown _ = Left $ "Unknown reset arg(s): " ++ unwords unknown
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest to use the optparse-applicative even though it's quite simple, it's a way to future-proof our arg parsing (we want to move it completely to optparse-applicative at some point).

Take a look at https://github.com/wasp-lang/wasp/blob/main/waspc/cli/src/Wasp/Cli/Command/BuildStart.hs#L26

Carlos built some nice parsing helpers which you can use 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems very nice, just confused as to why we send the name to withArguments, seems only for logging.
That seems a bit out of place to me, but I won't touch it.

Copy link
Member

@infomiho infomiho left a comment

Choose a reason for hiding this comment

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

Left some comments, I'd swap out custom argument parsing for a proper parser. Otherwise, I'm okay with the naming and the addition.

Comment on lines 98 to 108
prismaArgs =
[ "migrate",
"reset",
"--schema",
SP.fromAbsFile schema,
"--skip-generate",
-- NOTE(martin): We do "--skip-seed" here because I just think seeding
-- happening automatically on reset is too aggressive / confusing.
"--skip-seed"
]
++ if force resetArgs then ["--force"] else []
Copy link
Member

Choose a reason for hiding this comment

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

When I commented on this line, I thought you can move the whole prismaArgs where it was previously, but I won't block on this.

RAW

Copy link
Member

@infomiho infomiho left a comment

Choose a reason for hiding this comment

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

Good job

@FranjoMindek FranjoMindek merged commit 4892df8 into main Dec 9, 2025
26 checks passed
@FranjoMindek FranjoMindek deleted the franjo/add-force-flag-to-reset- branch December 9, 2025 13:37
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