Questions tagged [rollback]

A rollback is reverting data to a previous state. Typically questions in this tag involve transactions in Relational Database Management Systems, where a ROLLBACK command is used to discard any changes to the data since a transaction started.

1545 questions
57
votes
4 answers

Rake db:migrate - how do I undo all migrations and redo them

Is there a quick rake db:rollback command for all of the migrations?
Lucy Weatherford
  • 5,452
  • 16
  • 50
  • 76
54
votes
3 answers

What are the differences between 'revert', 'amend,' 'rollback', and 'undo' a commit?

To help in my knowledge of git so I can use it day to day, what is the difference between: revert amend rollback undo What are they and what do they do?
gosbi
  • 755
  • 1
  • 6
  • 13
53
votes
1 answer

What is the difference between rollback, backout and strip in the Mercurial Eclipse plugin?

What is the difference between the menu items rollback, backout and strip in the Mercurial Eclipse plugin? Can I delete the commit in the local repository without modify the files in my workspace with one of this 3 commands? Or is there another…
Horcrux7
  • 23,758
  • 21
  • 98
  • 156
51
votes
3 answers

mysql transaction - roll back on any exception

Is it possible to roll back automatically if any error occurs on a list of mysql commands? for example something along the lines of: begin transaction; insert into myTable values1 ... insert into myTable values2 ...; -- will throw an…
Urbanleg
  • 6,252
  • 16
  • 76
  • 139
51
votes
7 answers

Executing a stored procedure inside BEGIN/END TRANSACTION

If I create a Stored Procedure in SQL and call it (EXEC spStoredProcedure) within the BEGIN/END TRANSACTION, does this stored procedure also fall into the transaction? I didn't know if it worked like try/catches in C#.
Miles
  • 5,646
  • 18
  • 62
  • 86
48
votes
2 answers

Sequences not affected by transactions?

I have a table create table testtable( testtable_rid serial not null, data integer not null, constraint pk_testtable primary key(testtable_rid) ); So lets say I do this code about 20 times: begin; insert into testtable (data) values…
Earlz
  • 62,085
  • 98
  • 303
  • 499
47
votes
2 answers

What is the meaning of revert this commit and roll back this commit in GitHub for Windows?

Github for Windows features these two commands described as: revert this commit - create a new commit that reverts the changes of this commit rollback this commit - roll back this commit leaving all changes made in this and later commits in your…
Zingam
  • 4,498
  • 6
  • 28
  • 48
46
votes
7 answers

Rails: Is it bad to have an irreversible migration?

When is it acceptable to raise an ActiveRecord::IrreversibleMigration exception in the self.down method of a migration? When should you take the effort to actually implement the reverse of the migration?
readonly
  • 343,444
  • 107
  • 203
  • 205
38
votes
2 answers

EJB3 transaction rollback

I'm using CMT in EJB3 state-less session beans. Also I've created my own Exception having the annotation "@ApplicationException (rollback=true)". Do I have to use "context.setRollbackOnly()" when I want to rollback the transaction? Can I just…
ruwan.jayaweera
  • 1,196
  • 3
  • 11
  • 25
34
votes
7 answers

Cannot access SqlTransaction object to rollback in catch block

I've got a problem, and all articles or examples I found seem to not care about it. I want to do some database actions in a transaction. What I want to do is very similar to most examples: using (SqlConnection Conn = new…
Marks
  • 3,613
  • 5
  • 31
  • 46
34
votes
2 answers

Is there any way to recover recently deleted documents in MongoDB?

I have removed some documents in my last query by mistake, Is there any way to rollback my last query mongo collection. Here it is my last query : db.foo.remove({ "name" : "some_x_name"}) Is there any rollback/undo option? Can I get my data back?
trex
  • 3,848
  • 4
  • 31
  • 54
29
votes
1 answer

Why does rake db:rollback rollback three steps?

Normally when I do $ rake db:rollback it rolls back one migration. But now, repeatedly times, it has rollbacked 3 steps. How come this behaviour? I'm on Rails 3.2.13.
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232
29
votes
3 answers

How to raise an ActiveRecord::Rollback exception and return a value together?

I have a model that uses a acts_as_nested_set fork, and I've added a method to the model to save the model and move the node into the set in one transaction. This method calls a validation method to make sure the move is valid, which returns true or…
Daniel Vandersluis
  • 91,582
  • 23
  • 169
  • 153
28
votes
19 answers

Google App Engine: appcfg.py rollback

I'm using Windows 7 and for the life of me I cannot figure out how to call the rollback function on appcfg.py. All I want to know is what to type into the command prompt so I can rollback my app.
Petwoip
  • 1,365
  • 2
  • 17
  • 25
28
votes
3 answers

Does Specifying @Transactional rollbackFor Also Include RuntimeException

@Transactional(rollbackFor = MyCheckedException.class) public void foo() { throw new RuntimeException(); } Will this transaction get rolled back, or do I need to include RuntimeException.class in the annotation as well?
Alex Beardsley
  • 20,988
  • 15
  • 52
  • 67