couch_tomato 0.1.4 → 0.1.5
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.
@@ -5,20 +5,22 @@ module CouchTomato
|
|
5
5
|
def migrate(direction, db)
|
6
6
|
return unless respond_to?(direction)
|
7
7
|
|
8
|
+
write db.name
|
8
9
|
case direction
|
9
10
|
when :up then announce "migrating"
|
10
11
|
when :down then announce "reverting"
|
11
12
|
end
|
12
13
|
|
13
14
|
time = Benchmark.measure do
|
14
|
-
rows = db.get('_all_docs', :include_docs => true)['rows']
|
15
15
|
docs = []
|
16
|
+
|
17
|
+
rows = db.get('_all_docs', :include_docs => true)['rows']
|
16
18
|
rows.each do |row|
|
17
19
|
next if row['id'] =~ /^_design/
|
18
|
-
send(direction, row['doc'])
|
19
|
-
docs << row['doc']
|
20
|
+
docs << row['doc'] if send(direction, row['doc'])
|
20
21
|
end
|
21
|
-
|
22
|
+
|
23
|
+
db.bulk_save(docs) unless docs.empty?
|
22
24
|
end
|
23
25
|
|
24
26
|
case direction
|
@@ -104,7 +104,7 @@ module CouchTomato
|
|
104
104
|
def move(direction, db, migrations_path, steps)
|
105
105
|
migrator = self.new(direction, db, migrations_path)
|
106
106
|
start_index = migrator.migrations.index(migrator.current_migration) || 0
|
107
|
-
|
107
|
+
|
108
108
|
finish = migrator.migrations[start_index + steps]
|
109
109
|
version = finish ? finish.version : 0
|
110
110
|
send(direction, db, migrations_path, version)
|
@@ -150,7 +150,7 @@ module CouchTomato
|
|
150
150
|
runnable.pop if down? && !target.nil?
|
151
151
|
|
152
152
|
runnable.each do |migration|
|
153
|
-
|
153
|
+
RAILS_DEFAULT_LOGGER.info("Migrating to #{migration.name} (#{migration.version})")
|
154
154
|
|
155
155
|
# On our way up, we skip migrating the ones we've already migrated
|
156
156
|
next if up? && migrated.include?(migration.version.to_i)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couch_tomato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Plastic Trophy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-16 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|