horizon icon indicating copy to clipboard operation
horizon copied to clipboard

Add hz schema save --force option to enable overwriting

Open dalanmiller opened this issue 7 years ago • 5 comments

Starting state 1

$ tree 
.
├── .hz
│   ├── config.toml
│   ├── schema.toml
│   └── secrets.toml

Option 1:

hz schema save

$ tree
.
├── .hz
│   ├── config.toml
│   ├── schema.toml
│   ├── schema.toml.2016-08-03T19:55:28.876Z
│   └── secrets.toml

Option 2:

hz schema save --force

$ tree
.
├── .hz
│   ├── config.toml
│   ├── schema.toml # overwritten
│   └── secrets.toml

This should also work with hz schema save --out-file which will require --force before overwriting the specified output toml file and will error out without it specified.

dalanmiller avatar Aug 03 '16 20:08 dalanmiller

How about --overwrite instead of --force? --force can mean anything.

danielmewes avatar Aug 03 '16 20:08 danielmewes

... on the other hand, I think we have --force for schema apply though?

danielmewes avatar Aug 03 '16 20:08 danielmewes

I'm not sure the behavior for option 2 is good. I think maybe it should let you specify a file to save to, and error out if there's a conflict. Otherwise people will do things like hz schema save; hz cloud deploy and deploy the old schema rather than the one they just dumped.

mlucy avatar Aug 04 '16 05:08 mlucy

                                                                                  I believe the idea is to rename the *old* file, so schema.toml is always the most recent one. At least that's what I had in mind.                                                                                                                                     I think the old file should be called schema.toml.old.[date] or something like that though (i.e. Include the word old or bak in its name).

danielmewes avatar Aug 04 '16 06:08 danielmewes

I believe the idea is to rename the old file, so schema.toml is always the most recent one. At least that's what I had in mind.

This is correct.

I think the old file should be called schema.toml.old.[date] or something like that though (i.e. Include the word old or bak in its name).

I think this is a good addition for explicit clarity.

dalanmiller avatar Aug 10 '16 22:08 dalanmiller