Adds flag to publish to allow clearing on migration conflict.
Description of Changes
This PR modifies the --delete-data flag on spacetime publish and adds the --delete-data flag on spacetime dev.
In particular instead of --delete-data being a boolean, it is now a an enum:
always-> corresponds to the old value oftruenever-> corresponds to the old value offalseon-conflict-> clears the database, but only if publishing would have required a manual migration
This flag does NOT change any behavior about prompting users to confirm if they want to delete the data. Users will still be prompted to confirm UNLESS they pass the separate --yes flag.
spacetime dev gets the same --delete-data flag. The default value of never is equivalent to the existing behavior. spacetime dev continues to publish with --yes just as before. This behavior is unchanged.
API and ABI breaking changes
Adds the flags specified above. This is NOT a breaking change to the CLI. Passing --delete-data is the equivalent of --delete-data=always.
This IS technically a breaking change to the pre_publish route. As far as I'm aware this is only used by our CLI however.
IMPORTANT SIDE NOTE: I would argue that
--break-clientsshould really be renamed to--yes-break-clientsbecause it actually behaves like the--yesforce flag, but only for a subset of the user prompts. I have not made this change because it would be a breaking change, but if the reviewers agree, I will make this change.
Expected complexity level and risk
2, Very small change, but if we get it wrong users could accidentally lose data. I would ask reviewers to think about ways that users might accidentally pass --delete-data --yes.
Testing
- [ ] I have not yet tested manually.
Fixed all the comments!
Smoketests failing due to:
Publishing module...
Updated database with name: etabxtydzldgaoqcnhcq, identity: c2004f38704bab11f9ba1c355adcdcd04f935040df8af34d65ede783b176c9ef
2025-11-11 18:48:39,464 - DEBUG - --------------
2025-11-11 18:48:39,464 - DEBUG - $ spacetime --config-path /tmp/tmpry9gvhzm/config.toml publish etabxtydzldgaoqcnhcq --project-path /tmp/tmpry9gvhzm --yes
2025-11-11 18:48:40,621 - DEBUG - --- stderr ---
Compiling spacetime-module v0.1.0 (/tmp/tmpry9gvhzm)
Finished `release` profile [optimized] target(s) in 0.32s
Error: Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.
2025-11-11 18:48:40,621 - DEBUG - --- stdout ---
Build finished successfully.
Uploading to localhost => http://127.0.0.1:3000/
Checking for breaking changes...
Errors occurred:
Adding a column age to table person requires a default value annotation
Disabling auto-merge since I was only approving my code-owned changes.