Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve commit strategy #51

Open
kevlarr opened this issue Mar 17, 2024 · 0 comments
Open

Improve commit strategy #51

kevlarr opened this issue Mar 17, 2024 · 0 comments

Comments

@kevlarr
Copy link
Collaborator

kevlarr commented Mar 17, 2024

Right now migrations are performed (and recorded to the revisions table) without any explicit transaction or commit, leaving it up to the individual revisions to determine if they want to wrap their commands in a transaction and supply both begin and commit commands.

This can be problematic in several ways:

  1. It offloads the responsibility of 'safety' onto the user by default, meaning if they make a multi-command revision without a transaction and it fails halfway through, their schema is now corrupted
  2. It also opens the door for the individual revision to succeed but the action of recording to the revisions table to fail, in which case the database has been revised but there is no record of it, and subsequent jrny embark would re-try the revision that had already been applied

The 'simple' solution is to just implicitly wrap a revision & its recording in a single transaction, dropping the requirement that the user do so which solves (1.) above.

But that would be an issue for anyone who wants (or needs) to run a revision outside of a transaction, though - for instance creating an index concurrently. Thus there should be a way to not use a transaction for a specific revision, which leaves (2.) above unsolved.

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

No branches or pull requests

1 participant