cli icon indicating copy to clipboard operation
cli copied to clipboard

Add db reset command

Open cllns opened this issue 1 year ago • 2 comments

We should have a db reset command that does drop then create then prepare (maybe can avoid the 'create' since prepare can do that too)

Original:

It'd be nice to able to do:

HANAMI_ENV=test hanami db drop create prepare

Instead, now this only drops the DB and ignores the other args.

cllns avatar Jul 19 '24 21:07 cllns

This is an interesting idea! But I'd also be worried about leading to misunderstandings about how the rest of the CLI commands work (where we would support no such chaining).

My preference would be to double down on something like "db prepare" and make sure it's truly a one-stop command to go from zero to fully ready database.

And then if someone wants to chain it with db drop, they can use seperate &&-combined shell commands. After all, this is what the shell is there for!

Perhaps your desire to do a single-operation drop->create->prepare is motivation for us to create a single db reset command that does all that together? (and which will only ever work in dev/test environments only).

timriley avatar Jul 21 '24 06:07 timriley

Yea that's fair! db reset seems like the best solution. Changing the title of this issue

cllns avatar Jul 23 '24 19:07 cllns