storey 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/storey/migrator.rb +2 -1
- data/lib/storey/version.rb +1 -1
- data/lib/tasks/storey.rake +1 -1
- data/spec/dummy/db/schema.rb +11 -1
- data/spec/migrator_spec.rb +2 -1
- metadata +3 -3
data/lib/storey/migrator.rb
CHANGED
@@ -27,13 +27,14 @@ module Storey::Migrator
|
|
27
27
|
|
28
28
|
def rollback_all(step=1)
|
29
29
|
Storey.schemas.each do |schema_name|
|
30
|
-
puts "rolling back #{schema_name}"
|
31
30
|
self.rollback(schema_name, step)
|
32
31
|
end
|
32
|
+
Storey::Dumper.dump
|
33
33
|
end
|
34
34
|
|
35
35
|
def rollback(schema, step=1)
|
36
36
|
Storey.switch schema do
|
37
|
+
puts "= Rolling back `#{schema}` #{step} steps"
|
37
38
|
ActiveRecord::Migrator.rollback(
|
38
39
|
ActiveRecord::Migrator.migrations_path,
|
39
40
|
step
|
data/lib/storey/version.rb
CHANGED
data/lib/tasks/storey.rake
CHANGED
@@ -13,7 +13,7 @@ namespace :storey do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
desc "Rolls the schema back to the previous version (specify steps w/ STEP=n) across all schemas."
|
16
|
-
task :rollback =>
|
16
|
+
task :rollback => :environment do
|
17
17
|
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
|
18
18
|
Storey::Migrator.rollback_all(step)
|
19
19
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,6 +11,16 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120115060728) do
|
15
|
+
|
16
|
+
create_table "companies", :force => true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.string "schema_name"
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table "posts", :force => true do |t|
|
22
|
+
t.string "name"
|
23
|
+
t.text "body"
|
24
|
+
end
|
15
25
|
|
16
26
|
end
|
data/spec/migrator_spec.rb
CHANGED
@@ -68,12 +68,13 @@ describe Storey::Migrator do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
describe '.rollback_all' do
|
71
|
-
it 'should rollback all schemas exactly :steps times' do
|
71
|
+
it 'should rollback all schemas exactly :steps times and dump' do
|
72
72
|
steps = 2
|
73
73
|
['public', 'first_schema'].each do |schema|
|
74
74
|
described_class.should_receive(:rollback).
|
75
75
|
with(schema, steps).once
|
76
76
|
end
|
77
|
+
Storey::Dumper.should_receive(:dump).once
|
77
78
|
described_class.rollback_all(steps)
|
78
79
|
end
|
79
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash: -
|
195
|
+
hash: -1566227361179186623
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash: -
|
204
|
+
hash: -1566227361179186623
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project: storey
|
207
207
|
rubygems_version: 1.8.24
|