db_patch 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59e581d757718909d0fdd2cbc35320362df1fbfc
4
- data.tar.gz: e3b5fe49d2cd428d955576cdc3d640c3a42b7e87
3
+ metadata.gz: 3b7da414fc5f4f8d2d80d10c594f1e3ffc798221
4
+ data.tar.gz: 97f618f6b6f93c2e897f80c4565ddf8220e910e2
5
5
  SHA512:
6
- metadata.gz: b15ea07db56a9f6f92fe14ab7f83f23d4a45a599db4158b95a6e092ff3a03c21c63b53e267dbd8c7fb9dc9878a64185b249b12a998e14d30f488c1720d00f698
7
- data.tar.gz: b48e89afeff89e42ca63a585ee696ddbd13716fb6cf803e423d7bf46964e070fb0fbd003349e840645cbfac557331900e604a07ea22def315dedcaa09c3d9d8b
6
+ metadata.gz: 3dcab84d845670d1ad50d76143ed523bd987280c6f8e80f9851ffd77d67a1a303702dbdc6cf22dd7e5566c847141c865d0418ab874608e842c2ae10d68f9c593
7
+ data.tar.gz: b9715beb5c346c0030de473c7e6357dc9b817ffd399a860158d8fb09c9826913f10e66fc0f17f3164bf7a4c06332316def307ed90bb69a45679561ecd6642c45
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # rails_db_patch
2
2
  Manage tool for one-time ruby script which executed to DB in Rails application.
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/db_patch.svg)](http://badge.fury.io/rb/db_patch)
4
5
 
5
6
  ## Description
6
7
 
@@ -1,3 +1,3 @@
1
1
  module DbPatch
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -32,17 +32,18 @@ namespace :db do
32
32
  task :execute => :environment do
33
33
  patches = Dir.glob("#{patch_root}/*.rb")
34
34
  patches.each do |patch|
35
+
35
36
  basename = File.basename(patch, ".rb")
37
+ next unless DbPatch::PatchVersion.find_by(version: basename).nil?
38
+
39
+ # execute script
36
40
  require patch
37
41
 
38
- if DbPatch::PatchVersion.find_by(version: basename).nil?
39
- DbPatch::PatchVersion.create!(
40
- version: basename
41
- )
42
- end
42
+ DbPatch::PatchVersion.create!(
43
+ version: basename
44
+ )
43
45
 
44
- p "#{basename} executed."
45
-
46
+ p "#{basename}.rb executed."
46
47
  end
47
48
  end
48
49
 
@@ -51,18 +52,5 @@ namespace :db do
51
52
  "#{Rails.root}/db/patch"
52
53
  end
53
54
 
54
-
55
- class PatchVersion < ActiveRecord::Migration
56
- def self.up
57
- create_table :patch_versions do |t|
58
- t.string :version
59
- end
60
- end
61
-
62
- def self.down
63
- drop_table :patch_versions
64
- end
65
- end
66
-
67
55
  end
68
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuto Ogi