database_patcher 1.2.2 → 1.3.0

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: 0b893dce6dd6deba73506f946b131c874a4e266a
4
- data.tar.gz: 5c00d5f1a6f8116888f702bd71bda3fac4d34721
3
+ metadata.gz: a6f30ae5f966a66d023dedb2e52ec85352fcc2dc
4
+ data.tar.gz: f2dad5348b3d64fbf9e2655fd8c26bdb93a44db6
5
5
  SHA512:
6
- metadata.gz: a33bda126a1f16051e52de05abf1d2485eb7722a311fa920220dca41b26f8d418f5df60fc7f7bf4785e08681c96ccc22899afcc6111bb5f68e883c070f8c18a8
7
- data.tar.gz: ec07776a88cfe14ac60d703a0190b42662d9b5fec2186fa05bf62a3d2899eb795a4c8e1d260a7b091686f8a48815f3e614174e4d5d02559fcd7c4088ef93b6e7
6
+ metadata.gz: f0262661418ce2071f9518ac20cef05d185f2b378a4a2af4da734cf02f5692088b3e3eed5bd6f4135351c6ba7af94279063066ed42bba86f1fec90979f3c4301
7
+ data.tar.gz: 7c4999481222febae37e67fa6f0c7b7bea7c2c8b75ed9b53c0931c99a0e0b4b0d3753b2f92653fc8425c8cb0c0e40175158d56423f2e2ddd4b1e0d7baee97336
data/README.md CHANGED
@@ -60,4 +60,24 @@ The following commands supported:
60
60
  # use <your favorite editor> to edit the file/files
61
61
  $ database_patcher apply_pending_patches
62
62
 
63
- Here is a [cheat sheet](http://sequel.jeremyevans.net/rdoc/files/doc/cheat_sheet_rdoc.html) if you want use the ruby syntax for creating patches
63
+ Here is a [cheat sheet](http://sequel.jeremyevans.net/rdoc/files/doc/cheat_sheet_rdoc.html) if you want use the ruby syntax for creating patches
64
+
65
+ ### Rake integration
66
+
67
+ to use database_patcher from rake you can use the following:
68
+
69
+ #### Rakefile
70
+
71
+ ```ruby
72
+ require "database_patcher/rake_task"
73
+ ```
74
+
75
+ $ rake -T
76
+
77
+ ```sh
78
+ rake db:apply_pending_patches # apply pending schema migrations
79
+ rake db:create_patch[type,idempotent,description] # create a new migration patch
80
+ rake db:migrate # Alias task for apply_pending_patches
81
+ rake db:revert_installed_patches # apply pending schema migrations
82
+ rake db:rollback # rollback one patch
83
+ ```
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ require "bundler"
1
2
  require "bundler/gem_tasks"
2
3
  require "rspec/core/rake_task"
4
+ $LOAD_PATH.unshift(File.join(Bundler.root.to_s,'lib'))
5
+ require "database_patcher/rake_task"
3
6
 
4
7
  RSpec::Core::RakeTask.new(:spec)
5
-
6
8
  task :default => :spec
@@ -1,6 +1,6 @@
1
1
  require 'database_patcher'
2
2
  class DatabasePatcher::Command::Down < DatabasePatcher::Command
3
- names 'execute_all_remove_patch', 'remove', 'down'
3
+ names 'revert_installed_patches', 'remove', 'down'
4
4
  desc 'execute the down patches and remove all db patch'
5
5
 
6
6
  on_call do |*_|
@@ -0,0 +1,31 @@
1
+ require "database_patcher"
2
+ namespace :db do
3
+
4
+ desc 'apply pending schema migrations'
5
+ task :apply_pending_patches do
6
+ DatabasePatcher::Initializer.new.init
7
+ DatabasePatcher::PatchApplier.new.up
8
+ end
9
+
10
+ desc "Alias task for apply_pending_patches"
11
+ task :migrate => :apply_pending_patches
12
+
13
+ desc 'apply pending schema migrations'
14
+ task :revert_installed_patches do
15
+ DatabasePatcher::Initializer.new.init
16
+ DatabasePatcher::PatchApplier.new.down
17
+ end
18
+
19
+ desc 'rollback one patch'
20
+ task :rollback do
21
+ DatabasePatcher::Initializer.new.init
22
+ DatabasePatcher::PatchApplier.new.rollback
23
+ end
24
+
25
+ desc 'create a new migration patch'
26
+ task :create_patch, :type, :idempotent, :description do |t, args|
27
+ args.with_defaults(:type => 'ruby', :idempotent => false, :description => '')
28
+ DatabasePatcher::PatchCreator.new(args[:type], args[:idempotent],args[:description]).make
29
+ end
30
+
31
+ end
@@ -1,3 +1,3 @@
1
1
  module DatabasePatcher
2
- VERSION = "1.2.2"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_patcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
@@ -132,6 +132,7 @@ files:
132
132
  - lib/database_patcher/patch_entity.rb
133
133
  - lib/database_patcher/patch_entity/file.rb
134
134
  - lib/database_patcher/patch_entity/folder.rb
135
+ - lib/database_patcher/rake_task.rb
135
136
  - lib/database_patcher/version.rb
136
137
  homepage: https://github.com/adamluzsi/database_patcher.rb
137
138
  licenses: []