database_rollbacker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6770f7dbbfd676acf8c9ed34e0aae7fdce06339d
|
4
|
+
data.tar.gz: c5b3b5c5becea9c5d314ceb44bb7e87be8514d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ddd6b584a1f4c4f5562709f4785f3a3431a5f145cf3c26ecf33141d01cae3f27f46470291a54f9ca54fed6d9827d4a515d3c8f11fa127078f7236e7ac297c9c
|
7
|
+
data.tar.gz: f25b6949c78f18142f5fafcb8ddc8273217dfad314905fa2df732a873610e5f3bceb2aabf8ba892d975dd1ab9634f51557b87878a0a7c432e52a18517bc27b68
|
@@ -9,7 +9,7 @@ class DatabaseRollbacker::ActiveRecord::Rollbacker
|
|
9
9
|
|
10
10
|
def save(savepoint_name)
|
11
11
|
raise ArgumentError.new('duplicate savepoint name') if savepoint_exist?(savepoint_name)
|
12
|
-
transaction_number = ActiveRecord::Base.connection.
|
12
|
+
transaction_number = ActiveRecord::Base.connection.open_transactions
|
13
13
|
ActiveRecord::Base.connection.begin_transaction(joinable: false)
|
14
14
|
@savepoints.push DatabaseRollbacker::Savepoint.new(
|
15
15
|
savepoint_name,
|
@@ -19,8 +19,8 @@ class DatabaseRollbacker::ActiveRecord::Rollbacker
|
|
19
19
|
def rollback(savepoint_name)
|
20
20
|
savepoint = fetch_savepoint(savepoint_name)
|
21
21
|
raise ArgumentError.new("savepoint not found") unless savepoint.present?
|
22
|
-
while ActiveRecord::Base.connection.
|
23
|
-
break if ActiveRecord::Base.connection.
|
22
|
+
while ActiveRecord::Base.connection.open_transactions > 0 do
|
23
|
+
break if ActiveRecord::Base.connection.open_transactions == savepoint.savepoint_id
|
24
24
|
ActiveRecord::Base.connection.rollback_transaction
|
25
25
|
end
|
26
26
|
while @savepoints.present? do
|
@@ -34,7 +34,7 @@ class DatabaseRollbacker::ActiveRecord::Rollbacker
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def clean
|
37
|
-
while ActiveRecord::Base.connection.
|
37
|
+
while ActiveRecord::Base.connection.open_transactions > 0 do
|
38
38
|
ActiveRecord::Base.connection.rollback_transaction
|
39
39
|
end
|
40
40
|
@savepoints = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_rollbacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinsuke Nishio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|