Skip to content

Proposal: sqitch reset command for removing undeployed changes #865

@placetobejohan

Description

@placetobejohan

Problem Statement

In development, it's common to add multiple changes with sqitch add, then later decide some are unnecessary. Currently, removing undeployed changes requires:

  1. Editing sqitch.plan manually.
  2. Deleting the corresponding deploy, revert, and verify scripts.
  3. (If applicable) Removing from version control.

This process could be streamlined with a sqitch reset command, modeled after git reset.

Proposed Behavior

  • sqitch reset (without arguments)

    • Resets to the last deployed change.
    • Removes all undeployed changes from sqitch.plan.
    • Deletes their SQL files.
  • sqitch reset <change>

    • Resets to the specified <change>.
    • Tries to remove all changes after <change>.
    • Checks only the development database to determine if any of those changes are deployed.
    • Blocks removal if any of those changes are already deployed, displaying an error:

      "Change <next_change> is deployed on <target>. Run sqitch revert <target> -to <previous_change> first."

This ensures that changes aren’t removed while still deployed, preventing inconsistencies.

Future Enhancements

Options like --soft (keep SQL files) and --hard (also remove from VCS) could be considered later.

Would this be useful for others? Feedback is welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions