migration_tools 0.1.2 → 0.1.3
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.
- data/VERSION +1 -1
- data/lib/migration_tools/tasks.rb +6 -1
- data/migration_tools.gemspec +1 -1
- data/test/test_migration_tools.rb +3 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -17,9 +17,13 @@ module MigrationTools
|
|
17
17
|
@group
|
18
18
|
end
|
19
19
|
|
20
|
+
def migrator
|
21
|
+
@migrator ||= ActiveRecord::Migrator.new(:up, 'db/migrate')
|
22
|
+
end
|
23
|
+
|
20
24
|
def pending_migrations
|
21
25
|
return @pending_migrations if @pending_migrations
|
22
|
-
@pending_migrations =
|
26
|
+
@pending_migrations = migrator.pending_migrations
|
23
27
|
@pending_migrations = @pending_migrations.select { |proxy| group.empty? || proxy.migration_group == group }
|
24
28
|
|
25
29
|
@pending_migrations
|
@@ -55,6 +59,7 @@ module MigrationTools
|
|
55
59
|
else
|
56
60
|
pending_migrations.each do |migration|
|
57
61
|
migration.migrate(:up)
|
62
|
+
migrator.send(:record_version_state_after_migrating, migration.version)
|
58
63
|
end
|
59
64
|
end
|
60
65
|
end
|
data/migration_tools.gemspec
CHANGED
@@ -117,9 +117,11 @@ class TestMigrationTools < Test::Unit::TestCase
|
|
117
117
|
|
118
118
|
def test_migrate_group_with_pending
|
119
119
|
ENV['GROUP'] = 'before'
|
120
|
-
|
120
|
+
migrator = stub(:pending_migrations => proxies)
|
121
|
+
ActiveRecord::Migrator.expects(:new).returns(migrator)
|
121
122
|
proxies.select { |p| p.migration_group == 'before' }.each do |p|
|
122
123
|
p.expects(:migrate).with(:up).once
|
124
|
+
migrator.expects(:record_version_state_after_migrating).with(p.version).once
|
123
125
|
end
|
124
126
|
|
125
127
|
Rake::Task["db:migrate:group"].invoke
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migration_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|