seed_migration 1.0.3 → 1.0.4

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: 1b14ff645f5d47de31e2ddf8827739c5144d7def
4
- data.tar.gz: dcaea217bc557ea81df7b60c9a3bae5197c24343
3
+ metadata.gz: f8cbe10525d9a825e5345594b8ba3095fe7d63ed
4
+ data.tar.gz: c90f8982dac4016e9a4ca2bcb76455cae8c0e099
5
5
  SHA512:
6
- metadata.gz: 9638eb0ce5375411847366c4ea0dbb34d71adbe0ee286d572907090dd8eec88ea2437addf95ff7ad06a1ae2fa5f9c0712bc787414594c4c5489e0a683ec53a6c
7
- data.tar.gz: 55b8773cd27aa52b6eafc25bf9c56f0db99dabe09129200688e1d542ed2e03053baa6b001f9dad9e50c124589bbebac2e4e179081d358654d419ae626b0dabf8
6
+ metadata.gz: d25e906db4e6b95970fc98d06408689a3863253de53b09d44218a4455d8ba6e2185aede1ab688be073741f8001ab5fb998dc29b41ed31ff558d9115ada285f0e
7
+ data.tar.gz: 0e3e8a0dbd56640b66f50ceea6d6ef704eb038cfd544831e721247615cdb777ffdbb7ed1acb489ea864788ec199ef1109782afbfba299d74231beb3173b0813d
@@ -22,21 +22,23 @@ module SeedMigration
22
22
 
23
23
  start_time = Time.now
24
24
  announce("#{klass}: migrating")
25
- klass.new.up
26
- end_time = Time.now
27
- runtime = (end_time - start_time).to_d.round(2)
28
-
29
- # Create record
30
- migration = SeedMigration::DataMigration.new
31
- migration.version = version
32
- migration.runtime = runtime.to_i
33
- migration.migrated_on = DateTime.now
34
- begin
35
- migration.save!
36
- rescue Exception => e
37
- puts e
25
+ ActiveRecord::Base.transaction do
26
+ klass.new.up
27
+ end_time = Time.now
28
+ runtime = (end_time - start_time).to_d.round(2)
29
+
30
+ # Create record
31
+ migration = SeedMigration::DataMigration.new
32
+ migration.version = version
33
+ migration.runtime = runtime.to_i
34
+ migration.migrated_on = DateTime.now
35
+ begin
36
+ migration.save!
37
+ rescue Exception => e
38
+ puts e
39
+ end
40
+ announce("#{klass}: migrated (#{runtime}s)")
38
41
  end
39
- announce("#{klass}: migrated (#{runtime}s)")
40
42
  end
41
43
 
42
44
  def down
@@ -52,13 +54,15 @@ module SeedMigration
52
54
  # Revert
53
55
  start_time = Time.now
54
56
  announce("#{klass}: reverting")
55
- klass.new.down
56
- end_time = Time.now
57
- runtime = (end_time - start_time).to_d.round(2)
58
-
59
- # Delete record of migration
60
- migration.destroy
61
- announce("#{klass}: reverted (#{runtime}s)")
57
+ ActiveRecord::Base.transaction do
58
+ klass.new.down
59
+ end_time = Time.now
60
+ runtime = (end_time - start_time).to_d.round(2)
61
+
62
+ # Delete record of migration
63
+ migration.destroy
64
+ announce("#{klass}: reverted (#{runtime}s)")
65
+ end
62
66
  end
63
67
 
64
68
  # Rake methods
@@ -1,3 +1,3 @@
1
1
  module SeedMigration
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy O'Neill
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-08-15 00:00:00.000000000 Z
14
+ date: 2014-09-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sqlite3
@@ -132,3 +132,4 @@ signing_key:
132
132
  specification_version: 4
133
133
  summary: Rails Data Migration
134
134
  test_files: []
135
+ has_rdoc: