-
Notifications
You must be signed in to change notification settings - Fork 12
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
Sub context commit #62
base: master
Are you sure you want to change the base?
Conversation
A transaction-centric commit() will override this to work off of the change log
syncable transaction will want to do its own thing to fix up object's change_count
Testing by creating an object and saving it
What will happen if someone does something bad like create an object before starting a SyncableTransaction and then creates an object that references that first object within the transaction and then tries to commit? EDIT: Where by reference I am also implying a FK constraint. |
I'm pretty sure this will end up being useful in many places but the one that immediately comes to mind is in |
The commit would fail because of the FK constraint. We can actually have that situation right now if you have an object and fill in the linking ID property with a value that doesn't exist in the FK table. Another similar situation would be if you create an object outside the SyncableTX, change one of its properties inside the SyncableTX, then commit the SyncableTX. the commit would fail because it would issue an sql 'update' for a row that doesn't yet exists. I don't think the SyncableTX needs to do anything special to paper over these cases, since it's actually pointing out a programming error. |
What about if you change property |
Conflicts: lib/UR/Context.pm
Conflicts: lib/UR/Context.pm
This branch implements a new transaction UR::Context::SyncableTransaction. It allows any changes made while it's in effect to save to the DB without saving changes made outside.
I don't know if this will be the final implementation. It seems a bit hacky to me, and I don't like the name. It probably needs a lot more testing, too.